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.
Hello,
I've got two data tables, a parent table left joined to a child table. On the parent table I've applied a filter to show only four records. One of those filtered parent records has a child, the other three parent records do not. I've written the following measure to count the number of children for each of the four parent records:
ChildCount =
CALCULATE(
COUNTA('Child'[Child_id]),
ALLSELECTED('Parent'[Parent_ID])
)
When I add the calculated column to a table visual it filters out the three parent records that have zero child records. So then I tried the following:
ChildCount =
CALCULATE(
COUNTA('Child'[Child_id]),
ALLSELECTED('Parent'[Parent_ID])
) + 0
The problem is that this now returns every parent record and ignores the filer that I have to only show four parent records.
Any idea what's gone wrong? I'm sure it's an easy fix somewhere and most likely to do with the way I'm trying to show zeros in my measure when there are no child records.
Many thanks
H
Solved! Go to Solution.
Hi @Spotlamp ,
Please check the thread below which is similar to your problem, you can get the answer from it.
ALLSELECTED not being applied for calculated columns
In addition, if you want to understand the cause of this problem well, you may need to understand the difference and application scenarios between the calculated column and the measure. You can review these two blogs below for details.
Measure vs Calculated Column: The Mysterious Question? Not!
Calculated Columns and Measures in DAX
Best Regards
Hi @Spotlamp ,
Please check the thread below which is similar to your problem, you can get the answer from it.
ALLSELECTED not being applied for calculated columns
In addition, if you want to understand the cause of this problem well, you may need to understand the difference and application scenarios between the calculated column and the measure. You can review these two blogs below for details.
Measure vs Calculated Column: The Mysterious Question? Not!
Calculated Columns and Measures in DAX
Best Regards
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |