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
puserp
Regular Visitor

defference between two named expressions

Thanks to @Anonymous and @bhanu_gautam I finally got that working :

SUMMARIZECOLUMNS (
'TABLE 1'[Dim1], [...]
'TABLE 1'[Dim2],
'TABLE 1'[Dim3],
"Measure1 t1", CALCULATE ( SUM ( 'TABLE 1'[Measure1] ), 'TABLE 1'[Date] = "t1" ),
"Measure 2 t1", CALCULATE ( SUM ( 'TABLE 1'[Measure2] ), 'TABLE 1'[Date] = "t1" ),
"Measure1 t2", CALCULATE ( SUM ( 'TABLE 1'[Measure1] ), 'TABLE 1'[Date] = "t2" ),
"Measure 2 t2", CALCULATE ( SUM ( 'TABLE 1'[Measure2] ), 'TABLE 1'[Date] = "t2" )
)

Now, I'd like to to return difference between Measure1 at t2 - t1 ?

What is the syntax to call something like (adding the following line to the query above doesn't work):

DeltaT2T1 = [Measure1 t2] - [Measure1 t1]

Should I do something like :

VAR Measure1 t1 = CALCULATE ( SUM ( 'TABLE 1'[Measure1] ), 'TABLE 1'[Date] = "t1" ),
VAR Measure1 t2" = CALCULATE ( SUM ( 'TABLE 1'[Measure1] ), 'TABLE 1'[Date] = "t2" ),
SUMMARIZECOLUMNS (
'TABLE 1'[Dim1], [...]
"Measure1 t1", [Measure1 t1],
"Measure1 t2", [Measure1 t2],
"Delta", [Measure1 t2] - [Measure1 t1]
)

or is there another / better way ?

3 REPLIES 3
puserp
Regular Visitor

I voted mysel a RTFM  : "Columns in table variables cannot be referenced via TableName[ColumnName] syntax"

So what I wanted to do just can't be done.
The idea I had with measure would probably do the trick... but thoses measures can't use outside VAR which would be the case in my problem.

I guess I have to find another way

 

bhanu_gautam
Super User
Super User

Good job @puserp 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks 😉 , I still have a new question in this post 😉

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.