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

Calculating IF at row level

Hi,
Can anyone suggest where I am going wrong please? I need to create a measure that gives a classification to a row, based on the result of another measure. I have to create this as a measure as I don't have access to make a calculated column.

I have made measure 1 and measure2 to use withnin measure 3.

 

When I add measure 1 and 2 to my data the rows remain in the table as expected, the measures are applied for each row.

When I filter to show only one row, and add my thrid measure this also works ok.
When I show more rows, the measure 3 doens't appear to work at indivdual row level.

Can anyone suggest what I need to do for this to work correctly please?

 

Measure 1:

TimeDiff_ActualVsPlanned = SUMX('TABLE1',
'TABLE1'[Duration Minutes]-[Planned Minutes])

 

Measure 2:

PlannedVsActualVariant% = divide([TimeDiff_ActualVsPlanned],[Planned Minutes])

 

Measure 3:

OverUnderVarBracket =
IF (
[PlannedVsActualVariant%] < -0,
"less by under 25%",
IF (
[PlannedVsActualVariant%] < -0.251,
"underrun by 25-49%",
IF (
[PlannedVsActualVariant%] < 0.501,
"underrun by 50-84%",
IF (
[PlannedVsActualVariant%] < -0.851,
"underrun by 85-100%",
IF (
[PlannedVsActualVariant%] < -1,
"underrun by 100-149%",
IF (
[PlannedVsActualVariant%] < -1.5,
"underrun by 150% or more",
IF (
[PlannedVsActualVariant%] > 1.5,
"over by 150% or more",
IF (
[PlannedVsActualVariant%] >= 1,
"overun 100-149%",
IF (
[PlannedVsActualVariant%] > 0.851,
"overrun 85-100%",
IF (
[PlannedVsActualVariant%] > 0.501,
"overrun 50-84%",
IF (
[PlannedVsActualVariant%] > 0.251,
"overrun 25-49%",
IF ( [PlannedVsActualVariant%] > 0, "overrun less than 25%" )
)))))))))))

2 REPLIES 2

Hey, can you share some sample data in a xlsx/pbix file? Also I would rather work with SWITCH instead of multiple if statements for readability purposes.

Anonymous
Not applicable

Hi, applogies, I don't seem to be able to attach anything. I am wondering if because [Duration Minutes] and [Planned Minutes] are measures, this is why it is not working at row level, because they are already aggregated?

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.