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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.