Forum Discussion

khsj695's avatar
khsj695
Frequent Visitor
3 years ago
Solved

Change the interval in datediff by using the parameter?

Hello,   It is possible to easily change the output from the datediff formula from weeks to days?  I tried to replace the interval in the measure with the parameter ("WEEK" or "DAY") however, the ...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    One of ways to achieve this is,

    - create a measure using DATEDIFF with DAY parameter.
    - define how the business wants to see numbers of WEEK. For instance, is 8 days is one week or two weeks? I am not sure if the business wants to see the result like 1.15 weeks, but it depends on the business's requirement.

    - create a slicer that shows DAY or WEEK.
    - create an additional measure that describes, if DAY is selected, then show the result of the measure. If WEEK is selected, then divide the result of the measure by 7, and then add additional logic to the measure that only shows integer (depends on the business requirement).

     

    I hope this helps.

    Thanks.