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.
Hi all,
I have a number of measures that I have created which are dependent on each other and I would like the last one to be sued as a page level filter.
First measure : Calculates the LOS score for the last month
LOS Last Month Score = CALCULATE(AVERAGE(Sheet1[LOS Score]),dateadd(Sheet1[Date],-1,month))
Second measure: Calculates the LOS score for the month
LOS Month Score = CALCULATE(AVERAGE(Sheet1[LOS Score]),dateadd(Sheet1[Date].[date],1,month))
Third measure: Compares the 2 scores
LOS Worse than Last Month = if([LOS Last Month Score]<[LOS Month Score],"Y","N")
I then want to filter based on the last measure.
How can this be done?
Thanks
Hi ksan048,
To achieve your requirement, please use dax formula below:
LOS Worse than Last Month =
VAR LOS_Last_Month_Score =
CALCULATE ( AVERAGE ( Sheet1[LOS Score] ), DATEADD ( Sheet1[Date], -1, MONTH ) )
VAR LOS_Month_Score =
CALCULATE (
AVERAGE ( Sheet1[LOS Score] ),
DATEADD ( Sheet1[Date].[date], 1, MONTH )
)
RETURN
IF ( LOS_Last_Month_Score < LOS_Month_Score, "Y", "N" )
Regards,
Jimmy Tao
Thanks for replying. I gave it a go and it seemed to only return me 'N'.
I stuck all the measures in a table including the solution you provided which I have named the column as 'LOS worse' as shown below. (I have omitted the first column of IDs from the image).
I'm new to Power BI and need a bit of guidance!
Thanks a lot!
Were you able to figure out a solution? I'm trying to achieve something similar - and getting the same issue of repeating value. My suspicion is that you need to apply certain ALL() statements for it to work properly given granularity.
@wildmight2017 I hadn't manage to figure it out and ended up using Tableau instead as it accepted shape files that are of linestring types. I didn't need a workaround at all.......
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |