Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello, I have a problem with measures in DAX, I hope you can help me.
I would like to flag the cod_formula for which the characteristic doesn't occur most.
My dataset is like this :
I would like to have a 4th column with value "YES" if the characteristic is the most represented for each category and "NO" otherwise. In this example, it means there is only one value "NO" for the line
cod_formula 2021502 3 ; category CONSISTENCY ; characteristic 3/5 MEDIUM LOW
I tried to first calculate the number of occurence of each characteristic with the measure
Then I calculate the maximum occurence for each characteristic with the measure :
And finally I created the measure flg_max :
Which is cool!
But I don't know how to have these same results adding the cod_formula beacause I have this table. I want the number above repeated for each duo category/characteristic and it's not the case as I only have 1 as a value.
Hi @Anonymous
Beautiful code. Good job.
Maximum_category =
MAXX (
CALCULATETABLE (
VALUES ( 'senso'[characteristic] ),
ALLSELECTED ( senso[characteristic] ),
REMOVEFILTERS ( senso[code_formula] )
),
[Nb_frm_avant]
)
Hi! Thank you!
Unfortunately it doesn't solve my problem, I still have the same results in the last table I posted.
@Anonymous
Ok. Please try
Maximum_category =
MAXX (
VALUES ( senso[characteristic] ),
CALCULATE (
[Nb_frm_avant],
ALLEXCEPT ( senso, senso[characteristic], senso[category] )
)
)
Now I have this :
In the column "Maximum_category" I now have the results I would like to have in "Nb_frm_avant" 😅
Moreover I think I need to do a modification in the measure Nb_frm_avant also but I don't see which one ?
Create new measure
CALCULATE ( [Nb_frm_avant], ALLEXCEPT ( senso, senso[characteristic], senso[category] ) )
Hello @tamerj1 ,
Thank you for your help. I think I'm not far from the solution.
My last concern is about the Maximum_category measure.
I don't suceed to calculate the maximum of the measure you just told me in the last message (I called this measure Nb_occurence) by category
My measure is this one :
But it returns the same results as the measure as you can see :
Any idea ?
@Anonymous
What I meant like this
Maximum_category =
CALCULATE (
MAXX ( VALUES ( senso[characteristic] ), [Nb_frm_avant] ),
ALLEXCEPT ( senso, senso[characteristic], senso[category] )
)
User | Count |
---|---|
41 | |
27 | |
23 | |
19 | |
16 |
User | Count |
---|---|
55 | |
35 | |
21 | |
18 | |
15 |