Forum Discussion
Duration Days
- 6 years ago
The first block of M code is not a measure but an example of how to create the Duration column. Basically, in the query editor on the Add Column tab, click on Custom Column and then put an expression like this in the pop up box, substituting your actual column names in.
= if [Ticket Closed Date] = null then Duration.TotalHours([Restored Date]-[Ticket Opened Date])/24 else Duration.TotalHours([Ticket Closed Date]-[Ticket Opened Date])/24Then, hit Close & Apply to load the data with the new column, and then click on New Column in the ribbon and enter the DAX expression to get your new Days Range column (follow the pattern started to add more date ranges).
Regards,
Pat
The first block of M code is not a measure but an example of how to create the Duration column. Basically, in the query editor on the Add Column tab, click on Custom Column and then put an expression like this in the pop up box, substituting your actual column names in.
= if [Ticket Closed Date] = null then Duration.TotalHours([Restored Date]-[Ticket Opened Date])/24 else Duration.TotalHours([Ticket Closed Date]-[Ticket Opened Date])/24
Then, hit Close & Apply to load the data with the new column, and then click on New Column in the ribbon and enter the DAX expression to get your new Days Range column (follow the pattern started to add more date ranges).
Regards,
Pat
mahoneypat Thanks for the solution. I got the required result. But i have one Problem the order is not the same.
when i took tht column in table it is showing this way. I need this in orderwise. ex: 0-2 Days next 3-5 Days next 6-10 Days. As discussed earlier. Kindly help.
- v-alq-msft6 years agoCommunity Support
Hi, ghouse_peer
There is no direct way to solve the problem. As a workaround, you may create a new table with range and index columns. The pbix file is attached in the end.
Test:
Then you may create a measure as below.
Rank = LOOKUPVALUE(Test[Index],Test[Range],[Date Range])Finally you can click the measure column header to sort the table visual.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.