Forum Discussion
Help with dax formula
Hi Syndicate_Admin,
Oh, I got it! I got the wrong direction before.😝
Please refer the definition of the functions:
https://docs.microsoft.com/en-us/dax/hasonefilter-function-dax
Returns TRUE when the number of directly filtered values on columnName is one; otherwise returns FALSE.
If you choose two slicer options, it will return Blank().
For your first issue:
Please refer:
https://docs.microsoft.com/en-us/dax/selectedvalue-function
Returns the value when the context for columnName has been filtered down to one distinct value only. Otherwise returns alternateResult.
So, what is your expected output for the measure?
Best Regards,
Link
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Thanks in advance.
What I expect from the measure is that if I filter by two Projects, I give two results here:
Z event for one
Event X for another
(e.g.)
How could I do that? I have to touch the formula: "Have You One Filter? ISCROSSFILTERED('AFO Global Report'[Project Code])"; or I have to touch the formula: "Event Description is: IF([Has One Filter?],SELECTEDVALUE('AFO Global Report'[Last Quality Event Description],BLANK()))"
I don't know if what's wrong is the Blank() or that I don't have "alternateResult".
- v-xulin-mstf5 years agoCommunity Support
Hi Syndicate_Admin,
Your table needs to have an index or serial number column to distinguish each 'Event', if not, please add an index column.
Try measure as:
Measure= IF( ISFILTERED('AFO Global Report'[Project Code]), CALCULATED( MAX('AFO Global Report'[Last Quality Event Description]), FILTER( 'AFO Global Report'[INDEX]=MAX('AFO Global Report'[INDEX]) )), BLANK() )Best Regards,
LinkIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- Syndicate_Admin5 years agoAdministrator
good!
Thank you for your reply, but I'm afraid in this case the measure is not correct.
The measure would be like that anyway, wouldn't it?
Measure= IF( ISFILTERED('AFO Global Report'[Project Code]), CALCULATED( MAX('AFO Global Report'[Last Quality Event Description]), FILTER( 'AFO Global Report',MAX('AFO Global Report'[INDEX]) )), BLANK() )- v-xulin-mstf5 years agoCommunity Support
Hi Syndicate_Admin,
Ah, sorry, I made a mistake.
You are right.
Anyway, does it work well?
Best Regards,
LinkIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.