Forum Discussion
barragan82
Helper II
1 year agoDAX Measure for a Specific If and Then
Hello, I’m hoping to get help with a DAX measure that can do all of the following. [Assignments]>=110,*.1 (ex. If the sum is 236, multiply by 0.1 to render 23.6) [Assignments]>=10&&[Assignments]<...
- 1 year ago
Hi barragan82
Please try below dax measure:
Measure = SUMX ( SUMMARIZE ( 'Table', 'Table'[Course], "AssignmentsTotal", SUM ( 'Table'[Assignments] ) ), VAR AssignmentsTotal = [AssignmentsTotal] var a= IF( AssignmentsTotal>= 110, AssignmentsTotal * .1, IF( AssignmentsTotal >= 10, 10, IF( AssignmentsTotal>= 5, AssignmentsTotal, 0 ) ) ) RETURN a )Please give Kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
danextian
Super User
1 year agoHi barragan82
Try this:
SUMX (
VALUES ( table[course] ),
SWITCH (
TRUE (),
[Assignments] >= 110, [Assignments] * .1,
[Assignments] >= 10, 10,
[Assignments] >= 5, [Assignments],
0
)
)
- barragan821 year ago
Helper II
Hi danextian ,
Thank you for this DAX measure! Currently, the measure is applying the parameters to each individual row of data, not the sum. For example, there are three rows for Course A with Assignments values of 200, 30, and 6 to total 236. I am trying to apply the paramaters to the sum to get 23.6. Instead the parameters are being applied to each row to produce 20, 10, and 6 to get a total of 36. Any suggestions? Thank you!
- barragan821 year ago
Helper II
The measure provided by Praful_Potphode worked as I was hoping. No need to reply to my previous reply. Thank you!