Microsoft Power BI is an interactive data visualization software product developed by Microsoft with a primary focus on business intelligence. It is part of the Microsoft Power Platform. Power BI is a collection of software services, apps, and connectors that work together to turn various sources of data into static and interactive data visualizations. Data may be input by reading directly from a database, webpage, PDF, or structured files such as spreadsheets, CSV, XML, JSON, XLSX, and SharePoint.
A Business Case: New/Lost/Returning Customers
New Customers =
var _currdate=MAX('Calendar Lookup'[Transaction_Date].[Date])
var _salesthisperiod=[Sales per period]
var _customers=
ADDCOLUMNS(
'Customer Lookup',
"Sales Until Now",
CALCULATE(
[Sales per period],
DATESINPERIOD(
'Calendar Lookup'[Transaction_Date].[Date],
_currdate,
-1*[Period Value],
MONTH)),
"Running Total Sales",
[Running Total of Sales]
)
var _newcustomers=
FILTER(_customers,
[Running Total Sales]=[Sales Until Now] &&
[Sales Until Now]>0)
return
if(_salesthisperiod>0,
COUNTROWS(_newcustomers))
Lost Customers =
var _currdate=MAX('Calendar Lookup'[Transaction_Date].[Date])
var _salesthisperiod=[Sales per period]
var _customers=
ADDCOLUMNS(
'Customer Lookup',
"Sales Until Now",
CALCULATE(
[Sales per period],
DATESINPERIOD(
'Calendar Lookup'[Transaction_Date].[Date],
_currdate,
-1*[Period Value],
MONTH)),
"Running Total Sales",
[Running Total of Sales]
)
var _lostcustomers=
FILTER(_customers,
[Running Total Sales]>0 && [Sales Until Now]=0)
return
if(_salesthisperiod>0,
COUNTROWS(_lostcustomers)
)
Returning Customers =
var _currdate=MAX('Calendar Lookup'[Transaction_Date].[Date])
var _salesthisperiod=[Sales per period]
var _customers=
ADDCOLUMNS(
'Customer Lookup',
"Sales Until Now",
CALCULATE(
[Sales per period],
DATESINPERIOD(
'Calendar Lookup'[Transaction_Date].[Date],
_currdate,
-1*[Period Value],
MONTH)),
"Running Total Sales",
[Running Total of Sales])
var _returningcustomers=
FILTER(_customers,
[Sales Until Now]>0 && [Sales Until Now]<[Running Total Sales])
return
if(_salesthisperiod>0,
COUNTROWS(_returningcustomers))
Comments | NOTHING