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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
fabio_abbiati
New Member

Design line graph with weekly subtotal from record with differential quantity

Dear All,

 

I have a lot of records with the single quantity (eg. warehouse movements) and I would like to publish a line graphic with the total of each week (eg. weekly stock).

My problem is that I only have the weekly movements and not the week stock.

 

Example:

Week 1 (begining)100
Week 215
Week 3-5
Week 47
Week 5-20
Week 630
Week 78
Week 87
Week 9-30
Week 10-5

 

If I create a line graph with this data, I get something like below:

fabio_abbiati_0-1652798292536.png

This is not what I need beacuse on week 2 my stock was 115 (previous 100 + 15), on week 3 my stock was 110 (previous 115 - 5), on week 4 my stock was 117 (previus 110 + 7), ...

 

I would like to get a graph like below:

fabio_abbiati_1-1652798356000.png

 

Could anyone give me a tip to obtain the second type of graph?

How could I manage the data?

 

Thank you

Fabio

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @fabio_abbiati ,

 

The condition after FILTER should use '<=', otherwise the data of the first week will be missing.

Measure = 
CALCULATE(
    SUM('Table'[Value]),
        FILTER(
            ALL('Table'),
            'Table'[WeekNum]<=MAX('Table'[WeekNum])
        )   
)
vcgaomsft_1-1653016234180.png

Attached PBIX file for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @fabio_abbiati ,

 

The condition after FILTER should use '<=', otherwise the data of the first week will be missing.

Measure = 
CALCULATE(
    SUM('Table'[Value]),
        FILTER(
            ALL('Table'),
            'Table'[WeekNum]<=MAX('Table'[WeekNum])
        )   
)
vcgaomsft_1-1653016234180.png

Attached PBIX file for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

amitchandak
Super User
Super User

@fabio_abbiati , Assume you have Week No (Whole number too )

 

Calculate(Sum(Table[Value]), filter(all(Table), Table[Week No] < Max(Table[Week no]) )

 

If data is across year then use YYYYWW - Week Year column

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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