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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

If Statement creates repeating rows for data that doesnt exist

Hello All, 

 

When I try to compare a sum with another measure, I get repeating False values using an if statement.

 

Within threshold =
var threshold = round(CALCULATE(SUM('Stock'[DC QOH])) * 1.2, 0)


RETURN
if(CALCULATE(SUM('Stock'[DC QOH]) ) < thresh , TRUE() )

 

DC QOH  is a value in the stock table

 

Treshold = round(CALCULATE(SUM('Stock'[DC QOH])) * 1.2, 0)

 

 

msantos90_1-1713477363282.png

 

 

There are 3 tables: 1 fact table 'stock', 1 dim table 'location', 1 dim table 'item' 

 

How do I fix my dax statement remove the repeating irrelevant rows?

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello, Thank you for your help. I was able to solve my problem using another method. The issue due to 2 dim table columns being used in the matrix. 

I used this video: https://www.youtube.com/watch?v=3vcKgN8HxjY

 

and 

IF(COUNTROWS('(Live) Store Stock') = 1,if(CALCULATE(SUM('Stock'[DC QOH]) ) < thresh , TRUE() ))

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Maybe yes, you can provide some screenshot information and test data about the model for me to troubleshoot as soon as possible.

 

Best Regards,
Adamk Kong

Anonymous
Not applicable

Hello, Thank you for your help. I was able to solve my problem using another method. The issue due to 2 dim table columns being used in the matrix. 

I used this video: https://www.youtube.com/watch?v=3vcKgN8HxjY

 

and 

IF(COUNTROWS('(Live) Store Stock') = 1,if(CALCULATE(SUM('Stock'[DC QOH]) ) < thresh , TRUE() ))

 

 

Anonymous
Not applicable

Hi @Anonymous ,

 

Try to modify your formula like below:

WithinThreshold =
VAR Threshold =
    ROUND ( CALCULATE ( SUM ( 'Stock'[DC QOH] ) ) * 1.2, 0 )
RETURN
    IF (
        CALCULATE ( SUM ( 'Stock'[DC QOH] ), ALL ( 'Stock' ) ) < Threshold,
        TRUE (),
        FALSE ()
    )

vkongfanfmsft_0-1713517293297.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

This isn't working for my model, im still getting the same repeating values on my measure. Is this an issues with the way my model is set up?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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