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

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

Reply
Diportee97
Frequent Visitor

Dax error

IMG_0695.jpeg

 Hello guys,i created previous month percentage measures for this cards but the second and the third cards are showing outrageous percentages like -97% instead of 2,4,5-10% which is a bit messy,what is the way out guys

 

The link below is my attached pbix file

 

https://drive.google.com/file/d/1Mi74b1Ryrw_6vucvpBTxVcASLl_JFG_V/view?usp=drivesdk 

3 REPLIES 3
freginier
Solution Sage
Solution Sage

Hey there!

 

If I understood correctly, you are calculating previous month percentage changes for your cards, but the second and third cards are displaying incorrect percentages, such as -97% instead of expected values like 2%, 4%, 5%-10%.

 

Here are some new DAX formulas for you to try: 

1. Measure for Previous Month Value:

PreviousMonthValue =
CALCULATE(
SUM('Table'[MetricColumn]),
PREVIOUSMONTH('DateTable'[Date])
)

2. Measure for Percentage Change:

PercentageChange =
VAR CurrentValue = SUM('Table'[MetricColumn])
VAR PrevValue = CALCULATE(SUM('Table'[MetricColumn]), PREVIOUSMONTH('DateTable'[Date]))

RETURN
IF(
ISBLANK(PrevValue) || PrevValue = 0,
BLANK(), -- Avoid dividing by zero
DIVIDE(CurrentValue - PrevValue, PrevValue, 0)
)

 

Hopefully these formulas will work because it will handle division by zero which ensures previous month values exist before calculating percentages. It will correctly retrieves previous month values by using PREVIOUSMONTH() with a properly structured Date Table. And it fixes incorrect signs (e.g., -97%) by ensuring logical calculations.

 

Hope this helps!

😁😁

I don't really understand your Dax and I don't think it really tally with my already established Dax,I would love if you can view and check the pbix file i sent earlier 

hello @Diportee97 

 

i might be wrong but i think [Avg Satisfaction pm] and [Avg Wait Time pm] are taking value from wrong measure.

 

as you can see below, those pm value have all same value because they are using same exact DAX and same measure.

Irwan_1-1740190647716.png

 

[Patient Visit pm] is using [Patient Visit] which i think this is correct

Irwan_3-1740190752244.png

[Avg Satisfaction pm] is using [Patient Visit] instead of using [Avg Satisfaction Score]

Irwan_5-1740190915062.png

[Avg Wait Time pm] is using [Patient Visit] instead of using [Avg Wait Time]

Irwan_4-1740190813736.png

 

if i change the measure to the corresponding measure, i think the value looks more sensible.

Irwan_6-1740191052087.png

 

Hope this will help.

Thank you.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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