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
Anonymous
Not applicable

Calculate Column Iterating Subtotal Column

Hello All!

I am trying to calculate a column of the subtotal of revenue by a year-month column:

 

Yr-Mo    Revenue      SubTotal Revenue
2021-01  1,000,000    1,000,000
2021-02  1,000,000    2,000,000
2021-03  1,000,000    3,000,000
2021-04  1,000,000    4,000,000
2021-05  1,000,000    5,000,000

 

I've tried a number of functions and always returns 5,000,000 for every row.  

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi  @Anonymous ,

Use the following measure:

revenuetotal = CALCULATE(SUM('Table'[Revenue]),FILTER(ALL('Table'),'Table'[Yr-Mo]<=MAX('Table'[Yr-Mo])))

then create a new column:

v-luwang-msft_0-1622531821525.png

 

 

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

8 REPLIES 8
v-luwang-msft
Community Support
Community Support

Hi  @Anonymous ,

Use the following measure:

revenuetotal = CALCULATE(SUM('Table'[Revenue]),FILTER(ALL('Table'),'Table'[Yr-Mo]<=MAX('Table'[Yr-Mo])))

then create a new column:

v-luwang-msft_0-1622531821525.png

 

 

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

Anonymous
Not applicable

Awesome!  Thanks; didn't even know  that was a thing!

Fowmy
Super User
Super User

@Anonymous 

Try like this:

Sub Total Revenue = 

CALCULATE(
    SUM(Table3[Revenue   ]),
    FILTER( ALL(Table3[Yr-Mo   ]), Table3[Yr-Mo   ] <= MAX(Table3[Yr-Mo   ] ))
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy thank you for the quick reply.  It is returning the same value in the row for revenue.

@Anonymous 

 

Can you share a screenshot of the result?

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy can you send your results as well?  This is really tricky.

@Anonymous 

Please find attached the file.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Data Sample.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.

Top Solution Authors