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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
qwertzuiop
Advocate III
Advocate III

How to use IF-Statement in a measure to adjust values based on condition

Dear Power BI Community

 

I am at a loss at the moment.

Following problem:

 

Let's assume following tabel:

 

qwertzuiop_1-1657886062450.png

 

We have diffrent Checks (A, B, C, D...) - to reduce complexity, we only talk about a and b

Done is (0,1) weather the check is done

Planed is always (1)

 

A summarised table shows the following:

Check A has 4 "Done" of 12 "Planed"

Check B has 2 "Done" of 10"Planed"

 

qwertzuiop_2-1657886102080.png

means we have an achievement level of 6 out of 22

qwertzuiop_3-1657886292739.png

 

NOW to the main problem:

Le'ts assume we want to adjust the plan downwards like this for Check "A"

qwertzuiop_5-1657886756314.png

 

 

I did this by following measures:

Check A (adjusted by half) =
CALCULATE(SUM('table1'[Planed]),
FILTER('table1', ('table1'[Check] = "A" ))) / 2


Plan_Adjust =

IF( MIN('table1'[Check]) = "A", table1[Check A (adjusted by half)],
SUM(table1[Planed]))

 

If it's just one Check selected i works as expected

qwertzuiop_6-1657886913181.png

qwertzuiop_7-1657886932490.png


But when both Checks are selected we get the MIN (6) instead of the SUM (16)

 

qwertzuiop_8-1657886971978.png

 

I know there's a problem using the "MIN"-Statement in the measure, but i dont find any alternative.
Any ideas how to solve the problem?

 

Thank you very much for your contribution

 

Cheers
qwertzuiop

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @qwertzuiop 

please try

Plan_Adjust =
SUMX (
    VALUES ( table1[Check] ),
    CALCULATE (
        VAR NormalValue =
            SUM ( table1[Planed] )
        VAR AdjustedValue = NormalValue / 2
        RETURN
            IF ( MIN ( 'table1'[Check] ) = "A", AdjustedValue, NormalValue )
    )
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @qwertzuiop 

please try

Plan_Adjust =
SUMX (
    VALUES ( table1[Check] ),
    CALCULATE (
        VAR NormalValue =
            SUM ( table1[Planed] )
        VAR AdjustedValue = NormalValue / 2
        RETURN
            IF ( MIN ( 'table1'[Check] ) = "A", AdjustedValue, NormalValue )
    )
)
amitchandak
Super User
Super User

@qwertzuiop , Try a measure like

 

Sumx(values('table1'[Check]) , IF( MIN('table1'[Check]) = "A", table1[Check A (adjusted by half)],
SUM(table1[Planed])))
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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