Forum Discussion
Dom87326
4 years agoHelper II
KPI Visualization does not sum the data YoY
Hello, I'm trying to compare different time periods with Power BI KPI visuals and for that reason created following measures: Purchases = SUM('Purchases'[Quantity])
Previous Purchases...
aj1973
4 years agoCommunity Champion
Hi Dom87326
Your Measure must be
Previous Purchases = CALCULATE ([Purchases] , SAMEPERIODLASTYEAR('Date'[Date])
Dom87326
4 years agoHelper II
Hello aj1973 ,
I guess SAMEPERIODLASTYEAR would work if the KPI Value is correct. However in my case, values of KPI doesn't include 2021 Dec result of 147. Although when I use barchart it is included in the visual.
In the below example, filter is set on a page level and correct KPI value should be 553 instead of 386.
Thanks.
- aj19734 years agoCommunity Champion
Change the measure using SELECTEDVALUE[YEAR MONTH] as a VAR and CALCULATE the sum of Purchases filtering the selected value .
- Dom873264 years agoHelper II
Hi again aj1973 ,
Well, I've changed the initial measure to:Purchases = VAR _YM = SELECTEDVALUE('Date'[Year Month]) VAR _CALC = CALCULATE (SUM('Purchases'[Quantity])), 'Date'[Year Month]) RETURN _CALCHowever KPI still wouldn't return 2022 results.. Maybe I'm doing something wrong here?
Thanks!