Forum Discussion
Berrcikk
2 years agoFrequent Visitor
KPI Card Inifite number problem
Hello, I'm in the middle of creating a simple report, which uses KPI Card to display sales for current month, and sales for previous month. Although it works fine when there is a continuity fo...
- Anonymous2 years ago
Hi Berrcikk ,
My test data is as follows:You can try the DAX below:
Sales for current month = VAR Current_Month = SELECTEDVALUE('Table'[date].[MonthNo]) VAR SalesCurrentMonth = CALCULATE(SUM('Table'[sales]), 'Table'[date].[MonthNo] = Current_Month) RETURN IF(ISBLANK(SalesCurrentMonth), "N/A", SalesCurrentMonth)Sales for previous month = VAR Current_Month = SELECTEDVALUE('Table'[date].[MonthNo]) VAR Previous_Month = Current_Month - 1 VAR SalesPreviousMonth = CALCULATE(SUM('Table'[sales]), 'Table'[date].[MonthNo] = Previous_Month,ALL('Table')) RETURN IF(ISBLANK(SalesPreviousMonth), "N/A", SalesPreviousMonth)The final result looks like this:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi Berrcikk ,
My test data is as follows:
You can try the DAX below:
Sales for current month =
VAR Current_Month = SELECTEDVALUE('Table'[date].[MonthNo])
VAR SalesCurrentMonth = CALCULATE(SUM('Table'[sales]), 'Table'[date].[MonthNo] = Current_Month)
RETURN
IF(ISBLANK(SalesCurrentMonth), "N/A", SalesCurrentMonth)Sales for previous month =
VAR Current_Month = SELECTEDVALUE('Table'[date].[MonthNo])
VAR Previous_Month = Current_Month - 1
VAR SalesPreviousMonth = CALCULATE(SUM('Table'[sales]), 'Table'[date].[MonthNo] = Previous_Month,ALL('Table'))
RETURN IF(ISBLANK(SalesPreviousMonth), "N/A", SalesPreviousMonth)
The final result looks like this:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.