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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Please correct me IF condition

Hello Members, Please let me know is my below IF condition is correct / wrong. I am finding Totalminute between Issue Detection Time & Incident Start  which is generated by name XYZ

 

if [Triggered XYZ] = 1 {
if {
[#" Detection Time (UTC)"] < [#"Incident Start (UTC)"] then
Duration.TotalMinutes([#"Detection Time (UTC)"] - [#"Incident Start (UTC)"])
else
Duration.TotalMinutes([#"Incident Start (UTC)"] - [#"Detection Time (UTC)"])}
}
else
"null"
}

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try soething like this

if [Triggered XYZ] = 1 then
	if [#" Detection Time (UTC)"] < [#"Incident Start (UTC)"] then
	Duration.TotalMinutes([#"Detection Time (UTC)"] - [#"Incident Start (UTC)"])
	else
	Duration.TotalMinutes([#"Incident Start (UTC)"] - [#"Detection Time (UTC)"])
else
	"null"

 

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Try soething like this

if [Triggered XYZ] = 1 then
	if [#" Detection Time (UTC)"] < [#"Incident Start (UTC)"] then
	Duration.TotalMinutes([#"Detection Time (UTC)"] - [#"Incident Start (UTC)"])
	else
	Duration.TotalMinutes([#"Incident Start (UTC)"] - [#"Detection Time (UTC)"])
else
	"null"

 

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
AllisonKennedy
Community Champion
Community Champion

There is also a button in the Power Query ribbon to calculate duration or total minutes if you select the Detection Time and Incident Start columns, then look in the Add Column tab on the right. They might help you with a start, but I'm not sure where the IF part comes in based on your question.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Triggered BY --- IS having different team - I want to find only XYZ team is triggered by instead of other team.

and when i did Detection Time - Incident Start some times the value of detection time is more than the incident start. that time i get negative value. because of this i am using if & if

AllisonKennedy
Community Champion
Community Champion

This looks like something you might want to post in the Power Query forum: https://community.powerbi.com/t5/Power-Query/bd-p/power-bi-services

What are you trying to find? Please explain your criteria a bit more in 'plain english' so we can help troubleshoot your IF statement, and also please describe your problem. You probably need a 'for each' that seems to be missing.

Did you try starting with the simple Add Column tab in the ribbon and click the "Conditional Column" button? This will give you the bones/structure to start your formula.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

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.