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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ArchStanton
Impactful Individual
Impactful Individual

IF Statement

Hi,

 

I have the following code that works just fine when calculating the difference between Case Start & Case End when there is only 1 row of data, but when there are 2 row the total is doubled: 22 x 2 = 44, the answer is 22

 

ArchStanton_1-1661248928023.png

 

How can I modify this calculated column so that it doesn't double the Total Case Length? I know I can switch of the SUMMARISE feature in the visual but is there another way?

I am using a calculated column on purpose for this 

 

Total Case Length = 
    VAR _CaseStart = 'Deferrals'[Case Start]
    VAR _CaseEnd = 'Deferrals'[Case End]
    VAR _Table = FILTER(ALL('Date'),[Date] >= _CaseStart && [Date] <= _CaseEnd && [Is Working Day] = TRUE ())
RETURN
    IF(Deferrals[Count]>1,?,COUNTROWS(_Table)

 

 

Many thanks,

 

2 REPLIES 2
amitchandak
Super User
Super User

@ArchStanton , I think to do the total use summarize of values

 

Sumx(Values(Table[TIcket No]), [measure Total case length ])

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

Hi, 

I don't follow, what Values are you referring to in your example?

I tried a number of combinations and none of them work.

Also, I'm not using a measure because when I do I get the wrong result - I need a row context for this.

I would like to keep this as a calculated column if possible?

 

Thanks,

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.