Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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 ?
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
Good job @puserp
Proud to be a Super User! |
|
Thanks 😉 , I still have a new question in this post 😉