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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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"

 

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"

 

AllisonKennedy
Super User
Super User

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
Super User
Super User

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.