Forum Discussion

clarkey1988's avatar
clarkey1988
Helper II
5 years ago
Solved

Calculating Previous Week Data

Hi,

 

I wonder if anyone cna help me. I'm trying to calculate the previous week's sum of weight. So for week 20 in the screen shot below I need the Previous Week Weight column to reflect Week 19's weight (542,843). Currently my measure is showing 540,827. I have 5 filters shown in the screen shot and have included them in my measure but I seem to be pulling correctly on some but not others.

 

Any help would be greatly appreciated!

 

 

  • Hi, clarkey1988 

    If you think that the filters are breaking the measure, I suggest you to use the ALL() function to replace the ALLExcept() function in your original measure. Because the ALL() function can ignore any filters outside that might have been applied to avoid the effect of the visual filter.

    ALL() function in DAX

     

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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

9 Replies

  • Hi clarkey1988 

     

    Try it without MAX in your formula at the end. So, keep it like 'Degama'[Week Number] = 'Degama'[Week Number] - 1

     

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

     

    Thanks,

    Dheeraj

    • clarkey1988's avatar
      clarkey1988
      Helper II

      Hi dkaushik - unfortunately that did not seem to work. It actually didn't pull any values using that logic in the measure.

       

       

  • Hi clarkey1988 

    Would you able to share the pbix file?
    Also, I think the week - 1 logic should not be included under ALLEXCEPT.

      • dkaushik's avatar
        dkaushik
        Resolver II

        You can upload it to any cloud like google drive, dropbox, onedrive and attach the link in here to i can download and help you out 🙂

         

        Thanks,

        Dheeraj

  • v-robertq-msft's avatar
    v-robertq-msft
    Community Support

    Hi, clarkey1988 

    According to the sample picture you posted, the measure seems to be correct and useful. And it seems that the reason why the value of the 20 Week is blank is that the [week number] has been filtered by the visual filter?

     

    You can try to remove the filter and check if the measure can work.

     

    If you still have a problem, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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

    • clarkey1988's avatar
      clarkey1988
      Helper II

      Hi v-robertq-msft 

       

      That filter was jsut the top 2 max weeks so don't think that has an impact. However, I had 4 filters in my original picture. Once I clear them the measure works correctly. Somehow the filters are breaking the measure - but I thought I accounted for them in the measure code itself?

       

       

      • v-robertq-msft's avatar
        v-robertq-msft
        Community Support

        Hi, clarkey1988 

        If you think that the filters are breaking the measure, I suggest you to use the ALL() function to replace the ALLExcept() function in your original measure. Because the ALL() function can ignore any filters outside that might have been applied to avoid the effect of the visual filter.

        ALL() function in DAX

         

        Thank you very much!

         

        Best Regards,

        Community Support Team _Robert Qin

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