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
Eureka0206
New Member

IFs, or Switch - Data Aggregation

Hi Guys,

 

First i will start by saying im new to Power BI and come from a mainly excel background, so yes, im sure im doing this wrong!!

 

I'm trying to work on a dashboard for a department that deals with enquiries. They have a current KPI that records length of time taken to complete and enquiry. This is currently measured in 0,1,2,3 and 3+ days.

 

I have created a column that calculates the days to close.

 

Days to Close = if(ISBLANK(DataD[Date Completed]),BLANK(),DataD[Date Completed] - DataD[Date Issued by OS])
 
So if its not completed the Days to close is blank, but due to the dates given on date completed and  date issued by os, the resulting days range from -365+ to +600
 
I want to create a new column that aggregates the dates in DataD[Days to close] into blank, 0,1,2,3 and 3+
 
I have tried nested IF functions, as i would in excel but i keep getting errors.
 
Would anyone be able to give me some advice or guidance on how to do this in Power BI?
 
 
1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

For multiple IF structure similar to excel you can use SWITCH + TRUE combination. The basic structure is as follows:
NestedLogic = SWITCH(TRUE(),
"Condition 1", "Result 1",
"Condition 2", "Result2")

Typically in these kinds of categorization cases I would use measure for efficency, but a calculated column works all the same. 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!






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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Eureka0206
New Member

This worked perfectly. Thank you.

ValtteriN
Super User
Super User

Hi,

For multiple IF structure similar to excel you can use SWITCH + TRUE combination. The basic structure is as follows:
NestedLogic = SWITCH(TRUE(),
"Condition 1", "Result 1",
"Condition 2", "Result2")

Typically in these kinds of categorization cases I would use measure for efficency, but a calculated column works all the same. 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!






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

Proud to be a Super User!




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.