The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I'm trying to calculate the ratio on each line based on a sum from another line.
Example, the ratio for requests that have the status "Done" is the sum for the "new request" divided by the sum for the "Done" request.
My issue is that I don't know how to get the sum for the "new request" on the other lines. If I try the measure:
Ratio =
CALCULATE(
SUM('Requests'[Number]),
FILTER('Requests', 'Requests'[Status] = "New request"))
)
==> it's calculated only for the line "New request" and the result of this measure is not available on other lines, I don't get a value.
I guess I should do something with the "ALL" / "ALLEXCEPT" function but I couldn't find a solution.
Note: I'm not trying the achieve that exact visual, it's to show the expected data & calculations
Thank you for your help,
Solved! Go to Solution.
@Ncio
Can you try this:?, If it doesn't work, please share our dummy PBIX file to check.
Ratio =
DIVIDE(
SUM('Suivi des formations'[Valeur]),
CALCULATE(
SUM('Suivi des formations'[Valeur]),
filter(all('Suivi des formations'),
'Suivi des formations'[Type (détaillé)] = "Demandes reçues"
)
)
)
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Without the "sort by column" feature:
With the sort by column (it's the only change):
==> the ratio is not calculated anymore (column "test" on this screenshot)
Hi,
I finally found the cause, but not the solution:
On google, I could find some "side effect" of "sort by column", but I couldn't find how to solve it for your first answer:
Ratio =
DIVIDE(
SUM('Requests'[Number]),
CALCULATE(
SUM('Requests'[Number]),
'Requests'[Status] = "New request"
)
)
==> Any idea how to solve it?
==> I tried to upload the pbix here, but I get an error message.
It does, thanks!
(I still don't understand why your first solution worked well on the dummy data, but not the real one, but I'm happy that it works 🙂 )
@Ncio
Can you try this:?, If it doesn't work, please share our dummy PBIX file to check.
Ratio =
DIVIDE(
SUM('Suivi des formations'[Valeur]),
CALCULATE(
SUM('Suivi des formations'[Valeur]),
filter(all('Suivi des formations'),
'Suivi des formations'[Type (détaillé)] = "Demandes reçues"
)
)
)
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
The measure:
Ratio =
DIVIDE(
SUM('Suivi des formations'[Valeur]),
CALCULATE(
SUM('Suivi des formations'[Valeur]),
'Suivi des formations'[Type (détaillé)] = "Demandes reçues"
)
)
The source data (partial values):
Can you share the screenshot of your visual?
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
As I cannot share my "real" dashboard, i've created a dummy one... and your solution works perfectly... \o/
==> But it doesn't solve my issue on my real dashboard, the ratio stays empty :o(
* The tables between the dummy example and the real ones are very similar (some more columns, that's all)
* I've inactivated all links & filters, and it doesn't change anything
I'm not sure what could go wrong..
Hello,
Thank you for your answer, however it doesn't work:
@Ncio
Please try below measure for the ratio:
Ratio =
DIVIDE(
SUM('Requests'[Number]),
CALCULATE(
SUM('Requests'[Number]),
'Requests'[Status] = "New request"
)
)
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group