Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Experts
First I need to mention that this is through a live connection. All have a correct connection.
After reading several posts, I thought my measure was ready for the task, but no. There are two takeaways i want to use the measure for:
My Measure:
#Top 20 PostalCodes SalesNet =
VAR _Exclude =
FILTER(
KEEPFILTERS(VALUES('Customer'[Customer Postal Code])),
'Customer'[Customer Postal Code] <> "n/a"
)
VAR _SalesPerCode =
SUMMARIZECOLUMNS(
Customer[Customer Postal Code],
_Exclude,
"Sales Net",[Sales Net]
)
VAR _TOP20 =
TOPN(20,_SalesPerCode,0)
VAR _Core =
SUMMARIZECOLUMNS(
Customer[Customer Postal Code],
_Exclude,
_TOP20,
"Sales_Net", [Sales Net]
)
RETURN
SUMX(_Core, [Sales_Net])
For the 1 point, I'm stuck on understanding why the this gives me the following error:
For the 2 point im just plain stuck on how to solve this. When looking at this in DaxStudio, i get a table of the top sales net per postal code:
I am convinced that I should be able to hold the "Postal code" to be used further in a variable.
Grateful for all help!
Solved! Go to Solution.
As @smpa01 mentioned, while SUMMARIZECOLUMNS is great for DAX queries but isn't useful inside measures.
I don't think you need it here though. Try this:
#Top 20 PostalCodes SalesNet =
VAR _Exclude =
FILTER (
KEEPFILTERS ( VALUES ( 'Customer'[Customer Postal Code] ) ),
'Customer'[Customer Postal Code] <> "n/a"
)
VAR _SalesPerCode = ADDCOLUMNS ( _Exclude, "@SalesNet", [Sales Net] )
VAR _TOP20 = TOPN ( 20, _SalesPerCode, [@SalesNet] )
RETURN
SUMX ( _TOP20, [@SalesNet] )
As @smpa01 mentioned, while SUMMARIZECOLUMNS is great for DAX queries but isn't useful inside measures.
I don't think you need it here though. Try this:
#Top 20 PostalCodes SalesNet =
VAR _Exclude =
FILTER (
KEEPFILTERS ( VALUES ( 'Customer'[Customer Postal Code] ) ),
'Customer'[Customer Postal Code] <> "n/a"
)
VAR _SalesPerCode = ADDCOLUMNS ( _Exclude, "@SalesNet", [Sales Net] )
VAR _TOP20 = TOPN ( 20, _SalesPerCode, [@SalesNet] )
RETURN
SUMX ( _TOP20, [@SalesNet] )
Thx to both. Had missunderstood "SUMMARIZECOLUMNS" a bit outside queries 😀
Your edit gives the exact total as i was looking for, Thank you.
@Anonymous SUMMARIZECOLUMNS can't be utilized in a measure. It only works in DAX table expression.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |