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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
PBrainNWH
Helper II
Helper II

Calculation Help

The below calculation is returning all "Retained" values, is there something obvious you can see that's making that happen? The second IF statement should be like an ELSEIF, but PBI doesn't like that.

FY25 Status =
IF(
    SUM('Donations by Customer by FY'[2024 Donation Dollars]) <> 0 && SUM('Donations by Customer by FY'[2025 Donation Dollars]) <> 0,
    "Retained",
    IF(
        SUM('Donations by Customer by FY'[2024 Donation Dollars]) = 0 && SUM('Donations by Customer by FY'[2025 Donation Dollars]) <> 0,
        "New425",
        "Lapsed"
    )
)
1 ACCEPTED SOLUTION
gmsamborn
Super User
Super User

Hi @PBrainNWH 

 

To expand on @aduguid 's measure, for debugging it might be easier like the following.  If you aren't getting the correct result, you can always RETURN either of the variables for debugging.

 

FY25 Status 1 =
VAR _2024 = SUM( 'Donations by Customer by FY'[2024 Donation Dollars] )
VAR _2025 = SUM( 'Donations by Customer by FY'[2025 Donation Dollars] ) 
VAR _Logic =
	IF(
		_2024 <> 0
			&& _2025 <> 0,
		"Retained",
		IF(
			_2024 = 0
				&& _2025 <> 0,
			"New425",
			IF(
				_2024 <> 0
					&& _2025 = 0,
				"Lapsed",
				BLANK()
			)
		)
	)
RETURN
	_Logic

 

 

I hope this helps.

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

2 REPLIES 2
gmsamborn
Super User
Super User

Hi @PBrainNWH 

 

To expand on @aduguid 's measure, for debugging it might be easier like the following.  If you aren't getting the correct result, you can always RETURN either of the variables for debugging.

 

FY25 Status 1 =
VAR _2024 = SUM( 'Donations by Customer by FY'[2024 Donation Dollars] )
VAR _2025 = SUM( 'Donations by Customer by FY'[2025 Donation Dollars] ) 
VAR _Logic =
	IF(
		_2024 <> 0
			&& _2025 <> 0,
		"Retained",
		IF(
			_2024 = 0
				&& _2025 <> 0,
			"New425",
			IF(
				_2024 <> 0
					&& _2025 = 0,
				"Lapsed",
				BLANK()
			)
		)
	)
RETURN
	_Logic

 

 

I hope this helps.

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
aduguid
Memorable Member
Memorable Member

Try this measure

FY25 Status = 
IF (
    SUM('Donations by Customer by FY'[2024 Donation Dollars]) <> 0 
    && SUM('Donations by Customer by FY'[2025 Donation Dollars]) <> 0,
    "Retained",
    IF (
        SUM('Donations by Customer by FY'[2024 Donation Dollars]) = 0 
        && SUM('Donations by Customer by FY'[2025 Donation Dollars]) <> 0,
        "New425",
        IF (
            SUM('Donations by Customer by FY'[2024 Donation Dollars]) <> 0 
            && SUM('Donations by Customer by FY'[2025 Donation Dollars]) = 0,
            "Lapsed",
            BLANK()  -- This will handle any unexpected cases
        )
    )
)

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors