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.
First off, let me state that I am very new to DAX. The question I have relates to maintaining filter context after applying the ALL function to create a new measure.
The new measure identifies the all-time (ALL dDates) best max speed for each bike racer. When reporting daily max speed on a specific date, there are records for those who did not record a value on that date (but did over the previous year). I realize this is probably a simple solution but I am struggling to have both the date filter context in the pivot table and the all-time best measure for only those racers that recorded a max speed on that specific date. I would only like to report an all-time best max speed for those that had a max speed record on a specific date. My pivot table is below with a specific example where Racer 9 & 10 have no data for 10/21 but still show up because they have an all-time max speed. The DAX formulae are as follows:
Max Speed All Dates = CALCULATE ( MAX ( fData[Max Speed] ), FILTER ( ALL ( dDate ), dDate[Date] ) )
Max Speed per Racer =CALCULATE(MAX(fDataReference[Max Speed]),ALLEXCEPT(dRacerDetail,dRacerDetail[Racer]))
Thank you!
Steve
Solved! Go to Solution.
@sdgiss just adding a if function in your measure
Max Speed All Dates = IF([Daily Max],CALCULATE ( MAX ( fData[Max Speed] ), FILTER ( ALL ( dDate ), dDate[Date] ) )))
Hi, @amitchandak , @Anonymous , @wdx223_Daniel , a quick question please: can you guys shed some light on this expression?
FILTER ( ALL ( dDate ), dDate[Date] )
what's the differece between it and ALL ( dDate )? Thanks in advance!
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@CNENFRNL there is no need for the use of FILTER in this formula, as ALL is more than enough to achieve the result. My immature DAX brain was overcompensating with FILTER when writing this measure.
@sdgiss just adding a if function in your measure
Max Speed All Dates = IF([Daily Max],CALCULATE ( MAX ( fData[Max Speed] ), FILTER ( ALL ( dDate ), dDate[Date] ) )))
@sdgiss Hey Mate ,
You can try this .
Max Speed All Dates = if(HASONEVALUE(dDate[Date]),
CALCULATE ( MAX ( fData[Max Speed] ), FILTER ( ALL ( dDate ), dDate[Date] ) ),Blank() )
Max Speed per Racer =if(HASONEVALUE(dRacerDetail[Racer]), CALCULATE(MAX(fDataReference[Max Speed] ),Blank() )
Try this and let me know
You can use this as well.
@sdgiss , Try like
Max Speed All Dates = CALCULATE ( MAX ( fData[Max Speed] ), FILTER ( ALL ( dDate ), dDate[Date] ) ,not(isblank(fData[Max Speed] )) )
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 |
---|---|
43 | |
23 | |
21 | |
15 | |
15 |
User | Count |
---|---|
45 | |
31 | |
30 | |
18 | |
17 |