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
sdlx
Helper I
Helper I

Calculate weekly volume

Hi,

 

I have daily volume (Target.Custom) and I want to create a colum that will sum the daily volume by week (Week).

Capture.PNG

Can someone help me ?

 

Thanks in advance !

 
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @sdlx ,

 

Add the Index column starting from 1 ( close and apply)  and then add this calculated column:

 
SumOfWeeks =
Var prev=CALCULATE(SUM(Table[Target.Custom]),ALLexcept(Table,Table[Week]))
return
if([Index]>calculate(Min(Table[Index]),filter(all(Table),Table[Week]=earlier(Table[Week]))),blank(),prev)

 

 

let me know if this works.

 

Thanks,

Tejaswi

View solution in original post

V-pazhen-msft
Community Support
Community Support

@sdlx 

CALCULATE(SUM(Table[Target.Custom]),ALLexcept(Table,Table[Week]),Table[Year]=EARLIER(Table[Year]).
 
You would need to consider Year as a filter too, because in 2020 you would have the same week number to 2019. You don't want to sum them together.

Paul

View solution in original post

4 REPLIES 4
V-pazhen-msft
Community Support
Community Support

@sdlx 

CALCULATE(SUM(Table[Target.Custom]),ALLexcept(Table,Table[Week]),Table[Year]=EARLIER(Table[Year]).
 
You would need to consider Year as a filter too, because in 2020 you would have the same week number to 2019. You don't want to sum them together.

Paul
Anonymous
Not applicable

Hi @sdlx ,

 

Add the Index column starting from 1 ( close and apply)  and then add this calculated column:

 
SumOfWeeks =
Var prev=CALCULATE(SUM(Table[Target.Custom]),ALLexcept(Table,Table[Week]))
return
if([Index]>calculate(Min(Table[Index]),filter(all(Table),Table[Week]=earlier(Table[Week]))),blank(),prev)

 

 

let me know if this works.

 

Thanks,

Tejaswi

Hi !

 

Thank you for your quick response.

@Anonymous I tried your solution and I get this error message:

Capture.PNG

 

then I tried to add your filter @V-pazhen-msft :

 

And I get this message;

Capture1.PNG

 

Do you understand my mistake ?

 

thanks for your help !

 

Anonymous
Not applicable

HI @sdlx ,

 

Loks like you are trying to use it a a Measure.

 

Use this formula in a Calculated Column and you should be good to go,.

 

Capture-1.PNG

Thanks,

Tejaswi

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.