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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Help with calculated column

Hi, I have this table, I want to grab the Monthly value of ID 1 :

 

 

11.png

 

And put it in a calculated column for every ID (taking into account the Month) like this:

 

22.png

 

How can I achieve this with DAX ?

 

Thanks

 

 

2 ACCEPTED SOLUTIONS
FrankAT
Community Champion
Community Champion

Hi @Anonymous 

what about this solution:

 

25-09-_2020_22-39-10.png

 

X = CALCULATE(SUM('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Month]),'Table'[ID] = 1))

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=CALCULATE(SUM(Data[Value]),FILTER(Data,Data[ID]=1&&Data[Month]=EARLIER(Data[Month])))

Hope this helps.


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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=CALCULATE(SUM(Data[Value]),FILTER(Data,Data[ID]=1&&Data[Month]=EARLIER(Data[Month])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
FrankAT
Community Champion
Community Champion

Hi @Anonymous 

what about this solution:

 

25-09-_2020_22-39-10.png

 

X = CALCULATE(SUM('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Month]),'Table'[ID] = 1))

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

darentengmfs
Post Prodigy
Post Prodigy

Hi @Anonymous 

 

I know there's a faster way to do this but I do not know how, but this is how I would approach your problem.

 

  1. Create a new column, ID_New = 1, this will make all rows 1
  2. Change ID_New and ID columns data type into text
  3. Create 2 more new columns, ID_New-Month and ID-Month, with the formula ID_New-Month = concatenate(ID_New,Month) and ID-Month = concatenate(ID,Month)
  4. Once you have that, do a lookupvalue column. X = lookupvalue('Table'[Value], 'Table'[ID-Month], 'Table'[ID_New-Month])

 

As mentioned, there has to be a quicker way to do it, but this is how I would do it if I couldn't find the quick way.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.