Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
For simplicity sake, I have the following dummy data:
id val 1 5 1 30 1 50 1 15 2 120 2 60 2 10 2 10
My desired output is the following:
id SUM_GT_10% 1 95% 2 90%
SUM_GT_10% can be obtained by the following steps:
using the example data, the sum of val is 100 for id 1 and 200 for id 2, so we would obtain the following additional columns:
id val 1 2 1 5 100 5% 1 30 100 30% 1 50 100 50% 1 15 100 15% 2 120 200 60% 2 60 200 30% 2 10 200 5% 2 10 200 5%
And our final output (step 3) would be sum of 2 where 2> 10%:
id SUM_GT_10% 1 95% 2 90%
I don't care about the intermediate columns, just the final output, of course.
Solved! Go to Solution.
@mjsteele12
You can try this measure:
SUM 10% =
VAR _TOT =
CALCULATE(
SUM('Table'[VAL]),
ALLEXCEPT('Table','Table'[ID])
)
VAR _VAL =
SUMX(
FILTER(
ADDCOLUMNS(
'Table',
"VAL%",
DIVIDE(
('Table'[VAL]),
_TOT
)
),
[VAL%] > 0.1), 'Table'[VAL])
RETURN
DIVIDE(
_VAL,
_TOT
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@mjsteele12
You can try this measure:
SUM 10% =
VAR _TOT =
CALCULATE(
SUM('Table'[VAL]),
ALLEXCEPT('Table','Table'[ID])
)
VAR _VAL =
SUMX(
FILTER(
ADDCOLUMNS(
'Table',
"VAL%",
DIVIDE(
('Table'[VAL]),
_TOT
)
),
[VAL%] > 0.1), 'Table'[VAL])
RETURN
DIVIDE(
_VAL,
_TOT
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
This worked wonderfully, I can't thank you enough. Dax is proving challenging to learn, coming from other languages..
@mjsteele12
Appreciate it!
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Not sure if you are on s/o but if you want to get the reputation, you can add your answer here:
@mjsteele12
Thanks,
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group