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.
I have a measure that displays the following when I plug it into a Matrix.
I want to be able to use the values displayed in a separtate calculation, but plugging the measure in directly doesn't work since the measure needs these other rows and columns to filter properly.
I can export the visual to give me a csv with the correct numbers, but I want to avoid exporting and reintegrating a "new source" just to get the numbers back into PowerBI.
Solved! Go to Solution.
How you approach it depends on what you're trying to do with the values. If you only need to perform the calculation for a certain combination, or combinations, then could store it in a variable like
VAR MyValue =
CALCULATE (
[My Measure],
TREATAS (
{ ( "London", "Tops" ), ( "Paris", "Shoes" ) },
'Store'[Location],
'Product'[Category]
)
)
If you wanted to do sum of all the values, you could do something like
My Measure 2 =
VAR MyValue =
SUMX (
SUMMARIZE ( 'Table', 'Store'[Location], 'Product'[Category] ),
[My Measure]
)
RETURN
MyValue
Hi @Anonymous,
We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.
Thank you.
Hi @Anonymous,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
How you approach it depends on what you're trying to do with the values. If you only need to perform the calculation for a certain combination, or combinations, then could store it in a variable like
VAR MyValue =
CALCULATE (
[My Measure],
TREATAS (
{ ( "London", "Tops" ), ( "Paris", "Shoes" ) },
'Store'[Location],
'Product'[Category]
)
)
If you wanted to do sum of all the values, you could do something like
My Measure 2 =
VAR MyValue =
SUMX (
SUMMARIZE ( 'Table', 'Store'[Location], 'Product'[Category] ),
[My Measure]
)
RETURN
MyValue
I will eventually want to average the results in each column for each category.
The original measure is based on conditions. For example, if a specific condition is true, calculate the measure, else place a hardcoded value.
I've noticed when I drill up to the Category level, only the "calculated" measure values are taken into account and the hardcoded values are not. I want all the values in a column, calculated or hardcoded, to be averaged for a given category.
Hi @Anonymous,
I wanted to check if you had the opportunity to review the information provided by @johnt75 , @some_bih . Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
You want the second version of the code I posted, but replace SUMX with AVERAGEX.
Make sure to include all the columns in the SUMMARIZE which you have in the matrix visual.
Hi @Anonymous please check link for CALCULATETABLE function in DAX
Proud to be a Super User!
I'm not exactly sure how to implement this with a measure. Eventually, I want to average all the values in a column for a given category.
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
10 | |
6 |