Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
9 |