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.
Dear Friends,
I have the following table:
Description | Value |
Apple One | 3 |
Orange One | 8 |
Apple Two | 4 |
Orange Two | 10 |
I have to sum those values which contains "Two" in the description.
How can one achieve that without using a lot of CALCULATE formulas?
Thanks
Solved! Go to Solution.
Hey @gianmarco ,
I think the best approach is without any CALCULATE at all 😉
Try that one:
Sum contains Two =
SUMX(
myTable,
IF(
CONTAINSSTRING( myTable[Description], "two" ),
myTable[Value]
)
)
Sum TWO =
CALCULATE(
SUM( 'Table'[Value] ),
CONTAINSSTRING( 'Table'[Description], "TWO" )
)
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! |
Sum TWO =
CALCULATE(
SUM( 'Table'[Value] ),
CONTAINSSTRING( 'Table'[Description], "TWO" )
)
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! |
Hey @gianmarco ,
I think the best approach is without any CALCULATE at all 😉
Try that one:
Sum contains Two =
SUMX(
myTable,
IF(
CONTAINSSTRING( myTable[Description], "two" ),
myTable[Value]
)
)
Hey @gianmarco ,
you can also accept multiple posts as solution if they work for you 😉
But I'm happy you found a result for your problem.
Have a great weekend
Denis
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 |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |