Forum Discussion
"Restricted Measure"
Hi,
I want to create a "Restricted Measure" to calculate the Sales Amount.
Example, I want to see the Total Sales Amount by different Country. How can I do that?
Let say I have the following sales transactions:
Country Date Quantity Amount
Japan 01.01.2022 10 1000
China 01.01.2022 20 2000
Japan 02.01.2022 10 1000
Korea 02.01.2022 30 1000
How can I create a measure to calculate Total Sales Amount for Japan, Total Sales Amount for China, Total Sales Amount for Korea.?
There's a few ways to do this.. First - you don't need a measure. If your Amount field is set as a number and set to sum you can get this result:
Second - If you wanted a measure to do this instead you can use
Total Sales = SUM('table'[Amount])to get:
Third - You can create a measure that will force it to look at only the countries. This will ignore any other fields you add to your table which might make you think your total is incorrect. This is not the case as the measure is explicitly set to use only Country. I would not recommend using this one based on your description of the problem but thought I'd include it if it does help!Total Sales Country = CALCULATE(SUM('table'[Amount]),ALLEXCEPT('Table','Table'[Country]))to get:
- Anonymous4 years ago
Hi Anonymous ,
You could try this formula:
Measure = CALCULATE ( SUM ( 'table'[amount] ), FILTER ( ALLSELECTED ( 'table' ), 'table'[country] = SELECTEDVALUE ( 'table'[country] ) ) )
Best Regards,Jay
2 Replies
- Syk
Resident Rockstar
There's a few ways to do this.. First - you don't need a measure. If your Amount field is set as a number and set to sum you can get this result:
Second - If you wanted a measure to do this instead you can use
Total Sales = SUM('table'[Amount])to get:
Third - You can create a measure that will force it to look at only the countries. This will ignore any other fields you add to your table which might make you think your total is incorrect. This is not the case as the measure is explicitly set to use only Country. I would not recommend using this one based on your description of the problem but thought I'd include it if it does help!Total Sales Country = CALCULATE(SUM('table'[Amount]),ALLEXCEPT('Table','Table'[Country]))to get:
- AnonymousNot applicable
Hi Anonymous ,
You could try this formula:
Measure = CALCULATE ( SUM ( 'table'[amount] ), FILTER ( ALLSELECTED ( 'table' ), 'table'[country] = SELECTEDVALUE ( 'table'[country] ) ) )
Best Regards,Jay