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.
Hi, I'm new with powe bi. I don't understand why this code work
Solved! Go to Solution.
@kimalto452 - This is some context. Probably the biggest learning curve with DAX is understanding the context. It is literally the most important DAX concept. As such, it deserves a thorough explanation without anything vague.
Therefore, this is a calculated column for the row context to apply (see article). therefore
Consider this code:
This will return what was intended. Give me a sum of the price column for all rows in this table that match the same group value as the current row.
In front of this code:
So that's why you get the total sum for all rows in the second formula because obviously the group column in each row matches the group column in that row.
Now, consider this formula:
Hi,
In the second formula, what do you mean by [group]=[group]
@kimalto452 - This is some context. Probably the biggest learning curve with DAX is understanding the context. It is literally the most important DAX concept. As such, it deserves a thorough explanation without anything vague.
Therefore, this is a calculated column for the row context to apply (see article). therefore
Consider this code:
This will return what was intended. Give me a sum of the price column for all rows in this table that match the same group value as the current row.
In front of this code:
So that's why you get the total sum for all rows in the second formula because obviously the group column in each row matches the group column in that row.
Now, consider this formula:
@kimalto452 , to check this try it like this and check the values
VAR category=[group]
RETURN CALCULATE( [group], FILTER (table1,[group]=category) )
Total price by category=
CALCULATE( [group], FILTER (table1,[group]=[group]) )
in my understand you will get some value in all lines, in the second case you should get different values. row context should apply
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 |
---|---|
115 | |
99 | |
88 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |