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

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.

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


@ 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!:
The Definitive Guide to Power Query (M)

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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