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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Mehdi20
New Member

Sum different number of columns based on todays date

I have a data for sales in  different category per month like below:

 

 123456789101112
cat1522750600455378783856938987635258526
cat2307380907568967525365660
cat31000125613259961280125513261378125814599651333
cat4600455600455600600455652635600455752

 

I want sum of the different number of columns based  on today month No.
For Example. Today is Month 3 on year I want to Sum columns 4-12 but In month 4 want it to sum columns 5-12.
How can I write something that will only sum the data in my columns based on the Day Number?

1 REPLY 1
amitchandak
Super User
Super User

@Mehdi20 , First Unpivot the month in power query

Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g

 

Then you will have month on rows

 

Create an independent month table 

 

Month  = distinct(Table[Month])

 

use that is slicer and have a measure like

 

measure =

var _max = maxx(allselected(Month),Month[Month])

return

calculate(Sum(Table[Value]), filter(Table, Table[Month]>= _max ))

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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