Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
TornDigorn
Frequent Visitor

Custom KPI card - difference based on the previous month

Hello PBI community, 

 

I would like to create a custom KPI card that will show the difference in number + percentage difference for the current month vs. the previous one.

TornDigorn_0-1686911300715.png

 

For example, clicking on February, the difference in the custom KPI card should be

4.32 = 100%
3.21 = 74.3 %
200 - 74.3 % = 25.7%

 

Custom KPI card for February
- 1.11
- 25.7 %

 

Thank you so much ! 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @TornDigorn 

According to your descriptin, you want to custom the KPI card , and you want to show the differnce and the percentage in KPI card.

After my test, KPI displays Value and Goal by default, and there is no Difference:

vyueyunzhmsft_0-1687156130600.png

So for your need , you can follow this to create a custom KPI card:
Custom KPI card in Power BI - Data Bear - Power BI Training

 

And i can give your the dax code to get the  differnce and the percentage:

Difference = var _date = MAX('Table'[Date])
var _t = FILTER( ALL('Table'), YEAR('Table'[Date]) = YEAR(_date) && MONTH('Table'[Date])=MONTH(_date)-1)

return
CALCULATE( AVERAGE('Table'[Final Days]) ,  YEAR('Table'[Date]) = YEAR(_date) , MONTH('Table'[Date])=MONTH(_date)) - AVERAGEX(_t,[Final Days])
Percentage = var _date = MAX('Table'[Date])
var _t = FILTER( ALL('Table'), YEAR('Table'[Date]) = YEAR(_date) && MONTH('Table'[Date])=MONTH(_date)-1)

return
DIVIDE(CALCULATE( AVERAGE('Table'[Final Days]) ,  YEAR('Table'[Date]) = YEAR(_date) , MONTH('Table'[Date])=MONTH(_date)) - AVERAGEX(_t,[Final Days]) ,AVERAGEX(_t,[Final Days]))

 

The result is as follows:

vyueyunzhmsft_1-1687156206834.png

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @TornDigorn 

According to your descriptin, you want to custom the KPI card , and you want to show the differnce and the percentage in KPI card.

After my test, KPI displays Value and Goal by default, and there is no Difference:

vyueyunzhmsft_0-1687156130600.png

So for your need , you can follow this to create a custom KPI card:
Custom KPI card in Power BI - Data Bear - Power BI Training

 

And i can give your the dax code to get the  differnce and the percentage:

Difference = var _date = MAX('Table'[Date])
var _t = FILTER( ALL('Table'), YEAR('Table'[Date]) = YEAR(_date) && MONTH('Table'[Date])=MONTH(_date)-1)

return
CALCULATE( AVERAGE('Table'[Final Days]) ,  YEAR('Table'[Date]) = YEAR(_date) , MONTH('Table'[Date])=MONTH(_date)) - AVERAGEX(_t,[Final Days])
Percentage = var _date = MAX('Table'[Date])
var _t = FILTER( ALL('Table'), YEAR('Table'[Date]) = YEAR(_date) && MONTH('Table'[Date])=MONTH(_date)-1)

return
DIVIDE(CALCULATE( AVERAGE('Table'[Final Days]) ,  YEAR('Table'[Date]) = YEAR(_date) , MONTH('Table'[Date])=MONTH(_date)) - AVERAGEX(_t,[Final Days]) ,AVERAGEX(_t,[Final Days]))

 

The result is as follows:

vyueyunzhmsft_1-1687156206834.png

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.