Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
hi, i am trying to create KPI that will display percentage of difference between YTD data vs same month last year.
anyone can help me find solution for this?
i want to see the percentage of Jan - June 2022 vs Jan - June 2023 total units in my KPI card. (365,317 vs 362,110)
this is my DAX for YTD Units
i also tried units lastyear DAX but it calculates the subtotal of last year (848,424) instead of last years Jan-June data. (365,317)
can anyone help me fix this issue? i would like to see goal = 365,317 (Jan to June 2022 total units)
thanks! 🙂
@johnyip 😄
Solved! Go to Solution.
Please create a new measure as below, and then use it in your KPI Visual.
Total Units LY =
VAR CurrentDate= VALUE(FORMAT(MAXX(ALLSELECTED('financials (2)'),'financials (2)'[Date]),"YYYYMMDD"))
VAR TargetYear = ROUNDDOWN(CurrentDate/10000,0)-1
VAR TargetMonth = ROUNDDOWN((CurrentDate/10000 - TargetYear-1)*100,0)
VAR TargetDay = ((CurrentDate/10000 - TargetYear-1)*100-TargetMonth)*100
VAR TargetDate = DATE(TargetYear,TargetMonth,TargetDay)
RETURN
CALCULATE([Units], 'Date'[Date]<= TargetDate && 'Date'[Year] = TargetYear)
Please provide your sample pibx.
hi John. here's the link
https://drive.google.com/drive/folders/1i7N8YWWwMvZHEU08rxWIRDBsaC_kz6sg?usp=sharing
Please create a new measure as below, and then use it in your KPI Visual.
Total Units LY =
VAR CurrentDate= VALUE(FORMAT(MAXX(ALLSELECTED('financials (2)'),'financials (2)'[Date]),"YYYYMMDD"))
VAR TargetYear = ROUNDDOWN(CurrentDate/10000,0)-1
VAR TargetMonth = ROUNDDOWN((CurrentDate/10000 - TargetYear-1)*100,0)
VAR TargetDay = ((CurrentDate/10000 - TargetYear-1)*100-TargetMonth)*100
VAR TargetDate = DATE(TargetYear,TargetMonth,TargetDay)
RETURN
CALCULATE([Units], 'Date'[Date]<= TargetDate && 'Date'[Year] = TargetYear)
hi John. this works! thank you very much for your help, i really appreciate your time working on it!!!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
98 | |
75 | |
63 | |
62 |
User | Count |
---|---|
135 | |
105 | |
104 | |
80 | |
65 |