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.
I have been looking around the forum to find the answer but no luck yet
I have this table
Country | Condition | Quantity (measure) | Wanted measure |
France | 1 | 5 | 15 |
Italy | 0 | 2 | 15 |
Spain | 1 | 10 | 15 |
I want to basically get the total of my Quantity measure based on the condition
I would have thought = sumx(filter(table,condition<>1), Quantity ( measure)) would have done the trick, but it brings the exact same result. I am filtering the table.
Solved! Go to Solution.
@PowerBITestingG I would think:
Wanted measure =
VAR __Table = SUMMARIZE(ALLSELECTED('Table'),[Country],[Condition],"Quantity",[Quantity])
RETURN
SUMX(FILTER(__Table,[Condition] = 1),[Quantity])
@PowerBITestingG I would think:
Wanted measure =
VAR __Table = SUMMARIZE(ALLSELECTED('Table'),[Country],[Condition],"Quantity",[Quantity])
RETURN
SUMX(FILTER(__Table,[Condition] = 1),[Quantity])
@Greg_Deckler Can you see any future issues from using allselected inside a sumx? or we are not using it directly in it, so its not a problem?
Thank you!
@PowerBITestingG ALLSELECTED just removes the direct filters within the visual, so in this case Country and Condition, for example. It preserves all of the other filters coming from visual selections in other visuals. You can use ALLSELECTED on it's own, wrapped in a FILTER or SUMMARIZE or any other function that expects a table of values as a parameter. No, it is not resticted for sole use in CALCULATE but a lot of people seem to believe that is the case.
"For the sake of simplicity, we shorten that complex article into this best practice: never use ALLSELECTED inside an iteration."
@PowerBITestingG You could say the same thing about CALCULATE in general. People say similar stuff about SUMMARIZE but it's like this 1 extremely specific situation where you might get some craziness. I don't worry about edge cases that you aren't going to run into in any conceivable situation.
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 |
---|---|
100 | |
99 | |
80 | |
77 | |
66 |
User | Count |
---|---|
134 | |
106 | |
105 | |
86 | |
72 |