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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
sabd80
Helper IV
Helper IV

Previous week per category

Hi,
I would like to get last week volume per category.

Below is the total volume for 2 dates per category.

2024-09-18_14-54-12 1111.png

 

the measure is: 
Volume = sum(table[volume])+0

I want to get the volume of the previous week, the volume for category 1 is 0. because current week does not have category 1

Volume LW =
VAR CurWK = SELECTEDVALUE('table'[Date])
VAR PreWeek = CurWK-7
RETURN
CALCULATE([Volume],table[Date] = PreWeek)

 

2024-09-18_14-54-32 2222.png

what I want is to have 57 under category 1 in above visual.

 

Can you please help?

1 ACCEPTED SOLUTION
sabd80
Helper IV
Helper IV
7 REPLIES 7
sabd80
Helper IV
Helper IV

Anonymous
Not applicable

Hi @sabd80 ,

 

Thanks to Jpss  and Ashish_Mathur  for their interest in this issue. I have some other thoughts to add:

(1) This is my test data. 

vtangjiemsft_0-1727061948368.png

(2) We can create a measure. 

Measure = CALCULATE(SUM('Table'[volume]),FILTER(ALLSELECTED('Table'),[category]=MAX('Table'[category]) && [Date]=MAX('Table'[Date])-7))

(3) Then the result is as follows.

vtangjiemsft_1-1727061992708.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file with a Calendar table and week number column already built there.  Ensure that the visual is built as well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Jpss
Resolver II
Resolver II

hey @sabd80 
here is the solution i created for you. 

Jpss_0-1726638319996.png

I created it with following measure. 

lastWeekVolume = CALCULATE(SUM('Table'[Value]), DATEADD('Table'[Date],-7,DAY))

I transformed the dataset in following format for this measure 
Jpss_1-1726638473549.png

 

I hope this helps. 

 

Hi @Jpss ,

It did not work, because I don't have the records for the zero values in the data.

Yours work because you have the records for zero values.

Also the pbix file you have sent me is different from the screenshot you have provided

Hey, 
I created the solution based on the screenshot you shared.  It will be helpful if you can share a working PBIX file  that demonstrates your use case scenario and issue you have described above

 

Please remove the zero values in your data, that should help in creating the new measure.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.