Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Measure with filter on period based on different rules

Hi everyone,

 

I hope someone is able to help me on this.

 

I have one table with a list of assets with characteristics, among which their installation date (in date format).

I am trying to calculate a new measure calulating the time in seconds in a certain period. The period should be defined over a set of rules, linked to a time slicer. 

 

The rules to define the period are the following:

  • If the month selected in the slicer is the one of the installation date, the output should be the difference between the end of the month of the installation and the installation date in seconds
  • If the month in the slicer is the one of today, the output should be the difference between today and the beginning of the month in seconds
  • For the other months following the installation date but before the month of today, the output should be the entire time in the selected month in seconds

It would be perfect if I could also apply the same logics with a slicer in days.

 

Could someone please help me in building this? I am new to Power Bi and I am not able to do it yet.

 

Thanks in advance for the effort

1 Reply

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    According to your description, you need to create a calendar table, use functions such as IF, SELECTEDVALUE, etc., select a date in the slicer, judge in the if condition statement (the judgment condition is based on the content in your description), and return what you need result.


    If there is still confusion, please refer to the following link standards to reply to your needs again, I will answer your questions as soon as possible. Looking forward to your reply.

     

    How to Get Your Question Answered Quickly - Microsoft Power BI Community


    Best Regards,
    Henry


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