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
LEJ
Frequent Visitor

DATEADD (PREVIOUS MONTH) + SUMMARIZE

Dear all.

 

I have an issue with a DAX formula (I work with Power Pivot, not with Power BI). Problem ussing at the same time DATEADD + SUMMARIZE.

To be easier, I created a simple example with dates (only 2),  families, products, quantity and totals.

LEJ_0-1631281598541.png

 

 

What that I would like to calculate:

- A Pivot Table where selected 1 month, will appear this month and the previos one. With "Families" subtotal (see below).

- Calculate the difference due to Price variation (Price month - Price previous month) * Quantity previous month

- Calculate the difference due to Quantity variation (Quantity month - Quantity previous month) * Price month.


I would like to obtein a Pivot Table with the same information as in this one:

 
LEJ_1-1631281598041.png

 

 

Problem with subtotal and totals in the Var. Q and Var. P.
I tried with SUMMARIZE, but does not work with DATEADD...

 

Thank you!

Best Regards,

Javier

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@LEJ , Try add columns on top summzrize for such columns

example

measure  =

Var _tab =

Addcolumns(SUMMARIZE(Table, Table[Product], Table[Month]) , "_1",[This Month], "_2", [Last Month] , "_3", [Last month Qty])

Return

Sumx(_tab, ([_1] -[_2])*[_3])

 

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@LEJ , Try add columns on top summzrize for such columns

example

measure  =

Var _tab =

Addcolumns(SUMMARIZE(Table, Table[Product], Table[Month]) , "_1",[This Month], "_2", [Last Month] , "_3", [Last month Qty])

Return

Sumx(_tab, ([_1] -[_2])*[_3])

 

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

Thank you @amitchandak for your answer! Works correctly! Perfect!

 

 

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.