Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
clarkey1988
Helper II
Helper II

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!

 

clarkey1988_0-1621025145646.png

 

1 ACCEPTED SOLUTION

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.

View solution in original post

9 REPLIES 9
v-robertq-msft
Community Support
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?

v-robertq-msft_0-1621412384179.png

 

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.

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?

 

clarkey1988_0-1621459493519.png

 

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.

Hi everyone - I figured it out. Thanks so much for everyones help!

dkaushik
Resolver II
Resolver II

Hi @clarkey1988 

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

Hi @dkaushik 

 

How do I attached a PBIX with the data?

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

dkaushik
Resolver II
Resolver II

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

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

 

clarkey1988_0-1621264864644.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.