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
BobBI
Resolver III
Resolver III

Create filter for Good or Bad performance

Hello everyone,

 

I have data something like this 

 

Name       Date             value

A             1-Jan-18        20

B             1-Jan-18        35

C             1-Jan-18        15

 

A             1-Feb-18        10

B             1-Feb-18        15

C             1-Feb-18        35

 

A             1-Mar-18        11

B             1-Mar-18        25

C             1-Mar-18        05

 

My requirement is to create a filter with Good/Bad,  if the difference between current month value and ( average of last 2 months) is within +-10% then Good  otherwise Bad.

 

Difference =
VAR BASELINE_VALUE = CALCULATE(Value,
                      DATESINPERIOD('Date'[Date],LASTDATE('Date'[Date]),-1,Month))/2

VAR MEASURE_VALUE = Value (current month)
RETURN
 DIVIDE(MEASURE_VALUE-BASELINE_VALUE,BASELINE_VALUE)

 

doesn't give me correct result.

 

Any thoughts on this please.

 

Thanks

BB

 

 

1 ACCEPTED SOLUTION

Hi Phil,

 

Thanks for your response , I have tried all this beofre my post. it give me correct result for bottom level filter as my selection goes up it starting giving me wrong values. However i am able to resolve this issue by creating a calculated table.

 

Thanks,

BB

 

View solution in original post

2 REPLIES 2
Phil_Seamark
Employee
Employee

HI @BobBI

 

A good debugging technique is to break down your calculation in to smaller steps and asses the output of each variable and then check if it has the number you expect it to.

 

So try this first

 

 

Difference =
VAR BASELINE_VALUE = CALCULATE(Value,
                      DATESINPERIOD('Date'[Date],LASTDATE('Date'[Date]),-1,Month))/2

VAR MEASURE_VALUE = Value (current month)
RETURN
     MEASURE_VALUE

Then try this

 

Difference =
VAR BASELINE_VALUE = CALCULATE(Value,
                      DATESINPERIOD('Date'[Date],LASTDATE('Date'[Date]),-1,Month))/2

VAR MEASURE_VALUE = Value (current month)
RETURN
      BASELINE_VALUE

And this will at least let you understand which part of the calculation to focus on.

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi Phil,

 

Thanks for your response , I have tried all this beofre my post. it give me correct result for bottom level filter as my selection goes up it starting giving me wrong values. However i am able to resolve this issue by creating a calculated table.

 

Thanks,

BB

 

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.