Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
rjg2g11
Advocate I
Advocate I

Count and create a filter the number of zeros in a matrix by row

Example 1.png

Hello, 

 

Please see example of matrix above - this is an example of what i currently have in Power Bi. I am trying to create a filter that counts the number of 0s by row in a matrix.

 

What i would like to do is create a filter based how many not in stock products there are for each store. For Example, if i filter '5' not in stocks (0s), then i would get Region 78 Shop D.  

 

Thanks

3 REPLIES 3
Greg_Deckler
Super User
Super User

I would think that you would need a measure, your "Not in Stock" that counts the number of zeros that includes an ALLEXCEPT clause that specifies Region and Shop. I realize this is very general but would need sample/example data to be more specific. 

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

 

Please help me out with this

1.

Week. =
IF (
HASONEVALUE ( Dim_Date[Year] )
&& HASONEVALUE (Dim_Date[WeekOfYear]),
CALCULATE (
sum( Fact_Revenue_management[TransactionAmount]),
FILTER (
ALL ( Dim_Date ),
Dim_Date[Year] = VALUES ( Dim_Date[Year] )
&& Dim_Date[WeekOfYear] = VALUES ( Dim_Date[WeekOfYear] )
&& Dim_Date[DateTime] <= MAX ( Dim_Date[DateTime])
)
),
BLANK ()
)

 

2.

Todays = Calculate(COUNT(Fact_Revenue_management[DimCustomerID]),Filter(Fact_Revenue_management,Fact_Revenue_management[IsDuplicate] <> "true"  &&  Fact_Revenue_management[IsRefund] <> "true" && Fact_Revenue_management[TransactionStatus] <> "TXN_FAILURE"  &&  Today()-1))

 

3.

Todays = Calculate(COUNT(Fact_Revenue_management[DimCustomerID]),Filter(Fact_Revenue_management,Fact_Revenue_management[IsDuplicate] <> "true"  &&  Fact_Revenue_management[IsRefund] <> "true" && Fact_Revenue_management[TransactionStatus] <> "TXN_FAILURE"  ))

 

 

here i get same result for query 2 and 3  and in query 1 i need to calculate the count of previous week with the along with the conditions i have sued in query 2 and query 3.
Im trying from last week but no proper solution .pleaseeeee help me out  ASAP.

 

 

 

Please help me out with this

1.

Week. =
IF (
HASONEVALUE ( Dim_Date[Year] )
&& HASONEVALUE (Dim_Date[WeekOfYear]),
CALCULATE (
sum( Fact_Revenue_management[TransactionAmount]),
FILTER (
ALL ( Dim_Date ),
Dim_Date[Year] = VALUES ( Dim_Date[Year] )
&& Dim_Date[WeekOfYear] = VALUES ( Dim_Date[WeekOfYear] )
&& Dim_Date[DateTime] <= MAX ( Dim_Date[DateTime])
)
),
BLANK ()
)

 

2.

Todays = Calculate(COUNT(Fact_Revenue_management[DimCustomerID]),Filter(Fact_Revenue_management,Fact_Revenue_management[IsDuplicate] <> "true"  &&  Fact_Revenue_management[IsRefund] <> "true" && Fact_Revenue_management[TransactionStatus] <> "TXN_FAILURE"  &&  Today()-1))

 

3.

Todays = Calculate(COUNT(Fact_Revenue_management[DimCustomerID]),Filter(Fact_Revenue_management,Fact_Revenue_management[IsDuplicate] <> "true"  &&  Fact_Revenue_management[IsRefund] <> "true" && Fact_Revenue_management[TransactionStatus] <> "TXN_FAILURE"  ))

 

 

here i get same result for query 2 and 3  and in query 1 i need to calculate the count of previous week with the along with the conditions i have sued in query 2 and query 3.
Im trying from last week but no proper solution .pleaseeeee help me out  ASAP.

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.