__STYLES__
Key Insights:
Technical Details:
VAR SelectedCurrency = SELECTEDVALUE(
'Currency Seelction'[Currency],
"USD"
)
VAR SelectedDate = SELECTEDVALUE(
'Rolling Calendar'[Date],
CALCULATE(
MAX(
'Exchange Rates'[Date]
),
FILTER(ALL('Exchange Rates'),
'Exchange Rates'[Currency] = SelectedCurrency
)
)
)
VAR LatestRate = CALCULATE(
MAX('Exchange Rates'[Exchange]),
FILTER(ALL('Exchange Rates'),
'Exchange Rates'[Currency] = SelectedCurrency &&
'Exchange Rates'[Date] = SelectedDate
)
)
var RevenueCurrency =SUMX(
Sales,
(Sales[Quantity]*
RELATED(
Products[Unit Price USD]
)) *LatestRate
)
RETURN
RevenueCurrency
My goal was to display the monthly trend of customer loyalty. The business did a good job of building customer loyalty and trust and we can see by 2021 almost 80% are returning customers. Below is my Dax code to calculate returning customers, the expressions for new and churned are almost on similar lines.
Returning Customer =
VAR MaxDate = SELECTEDVALUE(
'Rolling Calendar'[Start of Month],
MAX('Rolling Calendar'[Start of Month]))
VAR PrevMonthDate = EOMONTH(MaxDate, -2)+1
var customerList = All(Sales[CustomerKey])
RETURN
COUNTROWS(
FILTER(
customerList,
(CALCULATE(
COUNTROWS('Sales'),
FILTER(
All('Rolling Calendar'[Start of Month]),
'Rolling Calendar'[Start of Month] < MaxDate
)) > 0)&&
(CALCULATE(
COUNTROWS('Sales'),
FILTER(
All('Rolling Calendar'[Start of Month]),
'Rolling Calendar'[Start of Month] = MaxDate
)) > 0)
)
)
This is the first PowerBi dashboard I have added to my portfolio and I aim to contribute more to this space.