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
msantos90
Frequent Visitor

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

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
v-kongfanf-msft
Community Support
Community Support

Hi @msantos90 ,

 

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

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() ))

 

 

v-kongfanf-msft
Community Support
Community Support

Hi @msantos90 ,

 

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.

 

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
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.