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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
chefe
Helper II
Helper II

SUM only accepts column ref

Hi there

 

I have DAX code for a one-column ("a") calculated table. See code and screenshot below.

 

SELECTCOLUMNS(
	ADDCOLUMNS(
		SUMMARIZE(
			FILTER(
				'Market data - Fx rates TTM'
				;'Market data - Fx rates TTM'[Fx ccy]="CNH"
				&& 'Market data - Fx rates TTM'[Spot/outright]="Spot"
				&& 'Market data - Fx rates TTM'[Quote type]="Mid"	
			)
			;'Market data - Fx rates TTM'[Fx date]
		)
		;"x=CNH";[EUR/CNH]
	)
	;"a"
	;[x=CNH]
)

2017-02-02 16_31_49-.png

 

What I want to do is SUM the values of this column, i.e. Measure = sum(calculated_table[a]).

 

BUT, I want to do this all _in memory_, without the need of an intermediate calculated table... therefore I went ahead and put this code into a SUM function directly 

 

sum a:= SUM(
	SELECTCOLUMNS(
		ADDCOLUMNS(
			SUMMARIZE(
				FILTER(
					'Market data - Fx rates TTM'
					;'Market data - Fx rates TTM'[Fx ccy]="CNH"
					&& 'Market data - Fx rates TTM'[Spot/outright]="Spot"
					&& 'Market data - Fx rates TTM'[Quote type]="Mid"	
				)
				;'Market data - Fx rates TTM'[Fx date]
			)
			;"x=CNH";[EUR/CNH]
		)
		;"a"
		;[x=CNH]
	)
)

2017-02-02 16_32_50-.png

 

However, this throws an error, stating that sum only takes a column reference...

 

How would I go about this?

 

Kind regards

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

2 REPLIES 2
Sean
Community Champion
Community Champion

@chefe  try SUMX instead

@Sean Thank you! Didn't think of that!

Cheers

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.