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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
adam_macs
Helper I
Helper I

IF statement in a measure

Hi, i am trying to write an IF statement in a measure to essentially look at the row and determine if its international or UK. If its international then it should minus the YTD retention % by 0.82, if its UK then minus the YTD retention % by 0.90.

 

The results i am getting are completly wrong which is due to the use of SUMX. Is there another way i can get this IF statement to work?

adam_macs_0-1639154429992.png

Retention Target Diff = 
SUMX(CountryMapping,
IF(CountryMapping[Region_L1]="United Kingdom",
[ACY21 _Retention_YTD]-0.9,
[ACY21 _Retention_YTD]-0.82))
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

I think you intend to sum over regions rather than the rows of CountryMapping.

 

Try this instead:

Retention Target Diff =
SUMX (
    VALUES ( CountryMapping[Region_L1] ),
    IF (
        CountryMapping[Region_L1] = "United Kingdom",
        [ACY21 _Retention_YTD] - 0.9,
        [ACY21 _Retention_YTD] - 0.82
    )
)

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

I think you intend to sum over regions rather than the rows of CountryMapping.

 

Try this instead:

Retention Target Diff =
SUMX (
    VALUES ( CountryMapping[Region_L1] ),
    IF (
        CountryMapping[Region_L1] = "United Kingdom",
        [ACY21 _Retention_YTD] - 0.9,
        [ACY21 _Retention_YTD] - 0.82
    )
)
ValtteriN
Super User
Super User

Hi,

If your YTD measure is working as intended this structure should do it:

Measure = IF(max(CountryMapping[Region])="United Kingdom",
[ACY21_Retention-YTD]-0.9,[ACY21_Retention-YTD]-0.82)

I hope this helps to solve your issue and if it deos consider accepting this as  a solution!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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