This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hello guys,
I have a matrix with 3 levels. For the second level, a sum is calculated over the third and second levels if the second Level is "open". Otherwise, there is an 'X'. Now, I want to know for each row how many values from the second level are used to calculate sums, within the respective filter context. In the corresponding example, the value '5' should be assigned for each entry
Any idea how I can get this done? Thank you for your help!
Chris
Solved! Go to Solution.
Thanks for the reply from Kedar_Pande.
Hi @Chris_23 ,
Please try the following dax:
CountNonXValues =
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Master'[Name] ),
FILTER (
ALLSELECTED ( 'Master' ),
'Master'[Sum] <> "X"
&& 'Master'[Sum] <> BLANK ()
)
)
RETURN
IF (
ISINSCOPE ( 'Master'[Region] ),
IF (
ISINSCOPE ( 'Master'[Region] ) && NOT ( ISINSCOPE ( 'Master'[Name] ) ),
IF ( 'Master'[Sum] <> "X" && 'Master'[Sum] <> BLANK (), _count, BLANK () ),
BLANK ()
),
_count
)
This is the result:
Best Regards,
Zhu
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from Kedar_Pande.
Hi @Chris_23 ,
Please try the following dax:
CountNonXValues =
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Master'[Name] ),
FILTER (
ALLSELECTED ( 'Master' ),
'Master'[Sum] <> "X"
&& 'Master'[Sum] <> BLANK ()
)
)
RETURN
IF (
ISINSCOPE ( 'Master'[Region] ),
IF (
ISINSCOPE ( 'Master'[Region] ) && NOT ( ISINSCOPE ( 'Master'[Name] ) ),
IF ( 'Master'[Sum] <> "X" && 'Master'[Sum] <> BLANK (), _count, BLANK () ),
BLANK ()
),
_count
)
This is the result:
Best Regards,
Zhu
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your reply. This is absolutely the solution I've looked for.
No, unfortunately that doesn’t lead to the desired result. In the respective filter context, each row should show 5, as a sum is being calculated over 5 rows.
Count Open Values =
VAR OpenValuesCount =
CALCULATE (
COUNTROWS ( 'YourTable' ),
'YourTable'[SecondLevel] = "Open" // Adjust based on your actual column name
)
RETURN
IF ( OpenValuesCount > 0, OpenValuesCount, BLANK() )
If this helped, a Kudos 👍 or Solution mark would be great!
Cheers,
Kedar Pande
www.linkedin.com/in/kedar-pande
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 31 | |
| 25 | |
| 21 | |
| 18 | |
| 17 |
| User | Count |
|---|---|
| 61 | |
| 35 | |
| 33 | |
| 23 | |
| 23 |