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
Nidhi_Kochrekar
Frequent Visitor

If Greater than and less than

Hello I am trying to get such output

 

 

IF [Seconds to Resolved State] = 0 THEN [Time to Open tickets]
ELSEIF [Seconds to Resolved State]>0 and [Seconds to Resolved State]<7200 THEN '<2 hours'
ELSEIF [Seconds to Resolved State]>=7200 and [Seconds to Resolved State]<14400 THEN '2-4 hours'
ELSEIF [Seconds to Resolved State]>=14400 and [Seconds to Resolved State]<28800 THEN '4-8 hours'
ELSEIF [Seconds to Resolved State]>=28800 and [Seconds to Resolved State]<86400 THEN '8-24 hours'
ELSEIF [Seconds to Resolved State]>=86400 THEN '>24 hours' END

7 REPLIES 7
v-yetao1-msft
Community Support
Community Support

Hi @Nidhi_Kochrekar 

I create a sample according to your scenario . [Seconds to Resolved State] and [Time to Open tickets] are all measures . Then create a measure to determine which interval the value of [Seconds to Resolved State] is in .

Measure = SWITCH(TRUE(),[Seconds to Resolved State]=0,[Time to Open tickets],
                        [Seconds to Resolved State]>0 && [Seconds to Resolved State]<7200,"<2 hours",
                        [Seconds to Resolved State]>=7200 && [Seconds to Resolved State]<14400,"2-4 hours",
                        [Seconds to Resolved State]>=14400 && [Seconds to Resolved State]<28800,"4-8 hours",
                        [Seconds to Resolved State]>=28800 && [Seconds to Resolved State]<86400,"8-24 hours",
                        [Seconds to Resolved State]>=86400 ,">24 hours")

And the final result is as shown :

Ailsamsft_0-1633076105666.png

I have attached my pbix file , you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Nidhi_Kochrekar
Frequent Visitor

I am Sorry, But it didnt worked

Hi @Nidhi_Kochrekar 

 

Try this measure:

 

 

Measure =
SWITCH (
TRUE (),
[Seconds to Resolved State] = 0,[Time to Open tickets],
[Seconds to Resolved State] > 0
&& [Seconds to Resolved State] < 7200, "<2 hours",
[Seconds to Resolved State] > 7200
&& [Seconds to Resolved State] < 14400, "2-4 hours",
[Seconds to Resolved State] > 14400
&& [Seconds to Resolved State] < 28800, "4-8 hours",
[Seconds to Resolved State] > 28800
&& [Seconds to Resolved State] < 86400, "4-8 hours",
ELSEIF[Seconds to Resolved State] >= 86400, ">24 hours"
)

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

@Nidhi_Kochrekar 

do you want to create a DAX column or a conditional column in PQ?

could you pls provide some sample data as well?





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

Proud to be a Super User!




I am creating measure.

 

at firts i created a measure to get difference between two dates in seconds.

and now i want to calculate below 

 

IF [Seconds to Resolved State] = 0 THEN [Time to Open tickets]
ELSEIF [Seconds to Resolved State]>0 and [Seconds to Resolved State]<7200 THEN '<2 hours'
ELSEIF [Seconds to Resolved State]>=7200 and [Seconds to Resolved State]<14400 THEN '2-4 hours'
ELSEIF [Seconds to Resolved State]>=14400 and [Seconds to Resolved State]<28800 THEN '4-8 hours'
ELSEIF [Seconds to Resolved State]>=28800 and [Seconds to Resolved State]<86400 THEN '8-24 hours'
ELSEIF [Seconds to Resolved State]>=86400 THEN '>24 hours' END

 

where [Seconds to Resolved State] and [Time to Open tickets] is my other measure.

 

@Nidhi_Kochrekar 

maybe you can try this

Measure =
SWITCH (
TRUE (),
[Seconds to Resolved State] = 0,[Time to Open tickets],
[Seconds to Resolved State] > 0
&& [Seconds to Resolved State] < 7200, "<2 hours",
[Seconds to Resolved State] > 7200
&& [Seconds to Resolved State] < 14400, "2-4 hours",
[Seconds to Resolved State] > 14400
&& [Seconds to Resolved State] < 28800, "4-8 hours",
[Seconds to Resolved State] > 28800
&& [Seconds to Resolved State] < 86400, "4-8 hours",
[Seconds to Resolved State] >= 86400, ">24 hours"
)




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

Proud to be a Super User!




VahidDM
Super User
Super User

Hi @Nidhi_Kochrekar 

 

Try this measure:

 

 

Measure = A =
SWITCH (
TRUE (),
[Seconds to Resolved State] = 0,[Time to Open tickets],
[Seconds to Resolved State] > 0
&& [Seconds to Resolved State] < 7200, "<2 hours",
[Seconds to Resolved State] > 7200
&& [Seconds to Resolved State] < 14400, "2-4 hours",
[Seconds to Resolved State] > 14400
&& [Seconds to Resolved State] < 28800, "4-8 hours",
[Seconds to Resolved State] > 28800
&& [Seconds to Resolved State] < 86400, "4-8 hours",
ELSEIF[Seconds to Resolved State] >= 86400, ">24 hours"
)

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

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.