Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I struggle with a specific KPI and my DAX formula. I thought I had it but I had to cave and ask for help. I really tried a lot of different approaches, except the right one then obviously... 🙂
What I want to do:
-Create a KPI that shows the Percentage difference between two suppliers' prices
What I have:
Problem
The Code:
Solved! Go to Solution.
Hi @tonijj ,
Thank you for reaching out to the Microsoft Community Forum.
I have created sample data based on your screenshot. Please refer below DAX measure to calculate the Weight Diff %.
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
Hi @tonijj ,
Thank you for reaching out to the Microsoft Community Forum.
I have created sample data based on your screenshot. Please refer below DAX measure to calculate the Weight Diff %.
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
Hi @tonijj ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
Hi @tonijj ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
Hi @tonijj , you can try this DAX code to solve the issue
& make sure you have removed the blanks in the query
DAX
% Diff :=
DIVIDE (
SUMX ( Pricing, Pricing[Cost B] - Pricing[Cost A] ),
SUM ( Pricing[Cost A] )
)
⭐Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together!🚀 [Explore More]
@GrowthNatives
Thank you for the help!
When using that formula, here is what I get, the measure is called "Dax Diff %" using the dax code above.
Any thoughts?
You can try this DAX Command
DAX
DAX % Diff :=
VAR _Start = SELECTEDVALUE ( StartDate[Date] )
VAR _End = SELECTEDVALUE ( EndDate[Date] )
RETURN
IF (
NOT ISBLANK ( _Start ) &&
NOT ISBLANK ( _End ) &&
_Start <= _End,
CALCULATE (
[% Diff],
KEEPFILTERS ( dimDate[Date] >= _Start ),
KEEPFILTERS ( dimDate[Date] <= _End )
)
)Just make sure you have these :
Ensure StartDate and EndDate tables are disconnected.
Slicers → single-select mode.
Visual → uses fields from dimDate (not StartDate/EndDate).
If you still see blanks, confirm your fact table actually has rows whose dimDate[Date] falls between the chosen start/end dates.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 67 | |
| 62 |