cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

Null values in calculated measure in matrix visual

Hello everyone,

 

I have created a matrix visual wit a dimension in rows (Store), a dimension in columns (Product) and with a calculated measure as Value (Measure1).

 

MatrixVisual MatrixVisual.png

 I need to show only the Stores with non-empty value in both A and B products. In the example above, I would need to display only Stores 3, 4, 6 and 7.

 

The number of products changes depending on a report level filter.

 

I have tried to solve it with the instructions in this link, but my case is slightly different because I do not filter the products explicitly. Products are filtered throught a related field in another table.

 

Measure =
IF (
    CALCULATE ( DISTINCTCOUNT ( Table1[Product] ), ALLSELECTED ( Table1[Product] ) )
        = COUNTROWS ( ALLSELECTED ( Table1[Product] ) ),
    SUM ( Table1[Units] )
)

The first part of the condition is correct, it returns the number of products with units on each store.

 

However, the second part of the condition is not working as I would like, because it returns the count of all products (432), without taking into account the implicit filters of products.

 

Could you be so kind to help me solving this issue?

 

Thank you so much in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Finally, I solved the issue changing the second condition of the IF in the measure, like this:

Measure = 
IF(
CALCULATE(
DISTINCTCOUNT(Table1[Product]);
ALLSELECTED(Table1[Product])
)
=
CALCULATE(
DISTINCTCOUNT(Table1[Product]);
ALLSELECTED(Table1[Product]);
ALLSELECTED(Table1[Store])
);
SUM(Table1[Units]))
 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Finally, I solved the issue changing the second condition of the IF in the measure, like this:

Measure = 
IF(
CALCULATE(
DISTINCTCOUNT(Table1[Product]);
ALLSELECTED(Table1[Product])
)
=
CALCULATE(
DISTINCTCOUNT(Table1[Product]);
ALLSELECTED(Table1[Product]);
ALLSELECTED(Table1[Store])
);
SUM(Table1[Units]))
 
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

I cannot view your pic as you shared. Could you please share your sample data and excepted result again? You can upload your files to onedrive and share the link here.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Greg_Deckler
Super User
Super User

Can you put your Measure in a Visual Filter and filter out the values that way?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler,

 

Thanks for your answer but it doesn't work.

 

When I filter the measure by "is not blank" I get exactly the same results because there are non blank values at least for one product of each row of the matrix.

 

When I filter by "is greater than 0" I also get the same rows, because there is at least one value greater than 0 in the row.

 

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors