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.
measures:
what I would like to achieve:
First, I tried summarizecolumns, but it gives "SummarizeColumns() and AddMissingItems() may not be used in this context" error message when put together with the dimentions in a table visual.
Then I created a table that works, but when I used it as a measure (by encapsulating the code below in a SUMX function), the measure did not create the correct values. Also, the crossjoin is a really heavy function to use. There must be a better way to do this. Does anyone have a suggestion on how to make this the right way?
since I cannot share the pbix file (such a shame) here is the data:
Fact1:
fact1_id;dim10_id;amount
1;1;1
2;2;2
3;2;1,5
Fact2:
fact2_id;dim10_id_f;dim20_id;amount
1;1;3;2
2;1;4;2
3;2;3;1
4;2;4;2
Dim10
dim10_id;dim10_name
1;name1
2;name2
Dim20
dim20_id;dim20_name
3;name3
4;name4
Solved! Go to Solution.
Create a couple of measures,
Measure 1 =
VAR SummaryTable =
ADDCOLUMNS (
VALUES ( Dim10[dim10_name] ),
"@val",
VAR SumAll =
CALCULATE ( [SumAll], REMOVEFILTERS ( Dim20 ) )
VAR Fact2Sum = [Fact2Sum]
RETURN
SumAll * Fact2Sum
)
RETURN
SUMX ( SummaryTable, [@val] )
I'm not too sure what you're definition of
"I want to exclude 'dim20' from the 'SumAll' calculation",
but see if this is what you are after (I'm posting all the measures so you can correct if a step is the wrong calculation):
Sum f1 =
SUM('fact 1'[amount])
Sum f2 =
SUM('fact 2'[amount])
Exclude dim20 =
CALCULATE([Sum f2], ALL(dim20))
SumALL =
[Sum f1] - [Exclude dim20]
Final Measure =
SUMX(dim10, [SumALL] * [Sum f2])
To get:
Proud to be a Super User!
Paul on Linkedin.
Thank you @johnt75 and @PaulDBrown. Both of your comments corrected my mistake and helped me solve my issue.
I used ALL(Fact2[dim20_id]) instead of ALL(dim20)
I'm not too sure what you're definition of
"I want to exclude 'dim20' from the 'SumAll' calculation",
but see if this is what you are after (I'm posting all the measures so you can correct if a step is the wrong calculation):
Sum f1 =
SUM('fact 1'[amount])
Sum f2 =
SUM('fact 2'[amount])
Exclude dim20 =
CALCULATE([Sum f2], ALL(dim20))
SumALL =
[Sum f1] - [Exclude dim20]
Final Measure =
SUMX(dim10, [SumALL] * [Sum f2])
To get:
Proud to be a Super User!
Paul on Linkedin.
Create a couple of measures,
Measure 1 =
VAR SummaryTable =
ADDCOLUMNS (
VALUES ( Dim10[dim10_name] ),
"@val",
VAR SumAll =
CALCULATE ( [SumAll], REMOVEFILTERS ( Dim20 ) )
VAR Fact2Sum = [Fact2Sum]
RETURN
SumAll * Fact2Sum
)
RETURN
SUMX ( SummaryTable, [@val] )
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 |
---|---|
72 | |
69 | |
55 | |
36 | |
31 |
User | Count |
---|---|
84 | |
63 | |
63 | |
49 | |
45 |