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
xiumi_hou
Post Partisan
Post Partisan

Need help for dax function to calculate percentage change

Dear All,

 

I have questions need your help. I have attached my pdix file for your convenience. 

 

1. I would like to create percentage change for the last session date score compare with the previous session score/baseline score(base line score is the first session date score) 

   E.g.  

 Session DateQ1Q2Q3Q4Q5Q6Q7Total 
People 17/1/2018231722017
People 18/1/2018252313319
People 18/20/2019142452220
People 19/1/2019162224118

 

When I filtered people 1, I would like to see below ideal result: 

QQQQ.JPG  

In this case, I only want to only compare total score, so

the baseline percentage should be (18-17)/17=5.9%

The percentage to compare previous session is (18-20)/20= -10%

  • If the score is positive: I would like to show a red up arrow before 5.9%
  • If the percentage is negative I would like to show green down arrow before 10%(remove the negative),
  • If there's no change, I would like to show "No change",
  • If the previous session is not available, I would like to show "Not available" .

 

The file are here:

https://1drv.ms/u/s!ArC4uvMBwvXve67V33EpYk5Fgpw?e=IOJwWy

https://1drv.ms/x/s!ArC4uvMBwvXveg8Z3LXLu2pwn6I?e=aEaCrw

 

I appreciate everyone's help. Thank you so much in advance!

 

2 ACCEPTED SOLUTIONS

HI @xiumi_hou 

 

The default card from Power BI Desktop doesn't allow to change the color based on a rule (Yet)... That's why I used in the solution the "Card with States by OKViz", but it's not exactly what you want...

image.png

 

Regards,

 

 

View solution in original post

Hi @xiumi_hou 

 

I have just found the solution you want...

One of the last updates from Power BI Desktop allows to configure the color for the Card based on a rule (it`s a quite a bit hidden) but it`s there, You will find the solution on the link below?

 

https://1drv.ms/u/s!AgrZ3ZAZxF2_guNDW_YI9arfR3uYjQ?e=eX33Nh

 

Here is the magic?

image.png

The colors in this image are configured in the wrong way, but in the solution are ok.

 

 

 

View solution in original post

6 REPLIES 6
pjjfmarques
Frequent Visitor

HI @xiumi_hou 

 

The file in the link below you can see two possible solutions, the graphical solution is not the one you asked for, but with the clues existing in the file you can change it and choose the one you think the best

 

https://1drv.ms/u/s!AgrZ3ZAZxF2_guNCXNumkrEk17M8iw?e=svxQ6A

 

I hope with this example you can have your problem solved

 

PJM

Thank you thank you! That's what I want. @pjjfmarques 

One more question: 

Can we only change the word color (Triangle and percentage ) in below situation? 

Like if percentage increase,  the triangle and percentage will show red? Thanks!WHI.JPG

 

HI @xiumi_hou 

 

The default card from Power BI Desktop doesn't allow to change the color based on a rule (Yet)... That's why I used in the solution the "Card with States by OKViz", but it's not exactly what you want...

image.png

 

Regards,

 

 

Hi @xiumi_hou 

 

I have just found the solution you want...

One of the last updates from Power BI Desktop allows to configure the color for the Card based on a rule (it`s a quite a bit hidden) but it`s there, You will find the solution on the link below?

 

https://1drv.ms/u/s!AgrZ3ZAZxF2_guNDW_YI9arfR3uYjQ?e=eX33Nh

 

Here is the magic?

image.png

The colors in this image are configured in the wrong way, but in the solution are ok.

 

 

 

Thank you !!

xiumi_hou
Post Partisan
Post Partisan

UP 

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.