Forum Discussion

Dlahey's avatar
Dlahey
Icon for Helper I rankHelper I
4 years ago
Solved

Custom Time Intelligence - Current Day in Month vs. Prior Months

I currently have weekly sales data refresh. I am looking to compare Week 1 of the month vs. prior Week 1's of all the prior months before that visually. In Week 2 I am looking to see a Cumulative sales for week1+2 vs. all prior Week 2 cumulative's of all the prior months. This would be the same for week 3 and week 4 as the data refreshes.

 

Is there custom coding that can allow me to do this? looking at MTD sales vs. Prior MTD using time intelligence does not provide the same outcome I am looking for.

 

thanks,

  • Yeah, sort of.  Keep in mind that this will be very wobbly at the beginning of the month.  Let's say

     

    July - starts on a Friday

    August - starts on a Monday

    September - starts on a Thursday

     

    Let's assume you only have transactions Monday through Friday.

     

    First 6 days:

    July: 4 working days

    Aug: 5 working days

    Sept: 4 working days

     

    I think you can see where this is going.  It becomes less of a problem the older a month gets.

5 Replies

  • I am looking to compare Week 1 of the month vs. prior Week 1's of all the prior months 

    Weeks and months are incompatible.

    • Dlahey's avatar
      Dlahey
      Icon for Helper I rankHelper I

      How about days in month vs. same days in month vs. prior months?

       

      ie. Sep = 6 days, vs. Aug = first 6 days, vs. Jul = first 6 days.....

      • lbendlin's avatar
        lbendlin
        Icon for Super User rankSuper User

        Yeah, sort of.  Keep in mind that this will be very wobbly at the beginning of the month.  Let's say

         

        July - starts on a Friday

        August - starts on a Monday

        September - starts on a Thursday

         

        Let's assume you only have transactions Monday through Friday.

         

        First 6 days:

        July: 4 working days

        Aug: 5 working days

        Sept: 4 working days

         

        I think you can see where this is going.  It becomes less of a problem the older a month gets.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Dlahey ,

     

    Based on your description, please try this measure.

    Measure = 
    VAR _date = CALCULATE(MAX('FactSalesTable'[Date]),ALL('FactSalesTable'))
    VAR _day = DAY(_date)
    VAR _year = SELECTEDVALUE('Calendar'[Year])
    VAR _month = SELECTEDVALUE('Calendar'[Month Number])
    VAR _sales = CALCULATE(SUM('FactSalesTable'[Sales]),FILTER('Calendar','Calendar'[Date]>=DATE(_year,_month,1)&&'Calendar'[Date]<=DATE(_year,_month,_day)))
    RETURN
    _sales

    The PBIX file is attached for reference.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data