cancel
Showing results for
Did you mean:
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
Community Support

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 :

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.

Frequent Visitor

I am Sorry, But it didnt worked

Community Champion

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.

Super User

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

could you pls provide some sample data as well?

Proud to be a Super User!

Frequent Visitor

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.

Super User

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"
)``````

Proud to be a Super User!

Community Champion

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.

Announcements