locked
DAX query to calculate previous week to current week RRS feed

  • Question

  • Currently I'm trying to get week on week trend using tabular model. I need some help to apply below scenario using dax query.

    applied current week by using distinctcount() function

    I need to create another calculated measure, which gives current week - previous week count 

    Weeknumber  currentweek previous week

    1                    10       10

    2                    20       10

    3                    15       -5

    Monday, January 16, 2017 7:36 PM

Answers

  • Hi Gugan.t,

    According to your description, you have created measure currentweek.

    To get week on week trend,  we need to get previous week first.

    Please see my sample DAX below:

    previous = CALCULATE(max(tab[currentweek]), (FILTER(ALL(tab),tab[Weeknumber]=MAX(tab[Weeknumber])-1)))

    Trend= max(tab[currentweek])-[previous]

    As i test in POWERBI Desktop, this works properly for me.


    Best Regards
    Willson Yuan
    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Wednesday, January 18, 2017 1:45 AM