Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I want to be able to return actual number and the percentage of it. I am following this tutorial https://bielite.com/blog/calculating-percent-of-subtotal/
This helps include percentages to decomposition tree. However, the problem is that when the last condition is true I want to return the actual number and percentage of subtotal. For instance like this: 1200, 22%. But when IF is true it returns nothing.
Patients =
VAR CurrentInitiated = VALUES(PROMSs[IsInitiated])
VAR CurrentCompleted = VALUES(PROMSs[IsCompleted])
VAR CurrentScore = VALUES('Score Order'[Final Score])
VAR CurrentIsLoggedIn = VALUES(PROMSs[IsLoggedIn])
VAR RevenueForCurrentSelection = SUM(PROMSs[AllPatients])
VAR InvitedPatients = VALUES(PROMSs[INVITED])
VAR TotalRevenue =
SWITCH(
TRUE(),------ logic here
IF(
ISINSCOPE(PROMSs[Invited]), FORMAT(12, "0.00%"),
--CONCATENATE(CONCATENATE(FORMAT(DIVIDE(RevenueForCurrentSelection, TotalRevenue), "0.00%"), " "), ------RevenueForCurrentSelection),
RevenueForCurrentSelection
)
What could be wrong here? I used constant value of 12 here to test but even 12 is not returning.
Hi @fatimaarshd ,
As far as I know, FORMAT() function will return text date type result. I think you just need to calcualte the number data type result by your measure and change the foramt as % in measure tool.
My Sample:
My Measure:
Revenue % =
VAR CurrentRetailerType = VALUES(Sales[Retailer type])
VAR CurrentProductLine = VALUES(Sales[Product line])
VAR RevenueForCurrentSelection = SUM(Sales[Revenue])
VAR TotalRevenue =
SWITCH(
TRUE(),
ISINSCOPE(Sales[Product line]),CALCULATE(SUM(Sales[Revenue]),ALLSELECTED(Sales),Sales[Retailer type] IN CurrentRetailerType),
ISINSCOPE(Sales[Retailer type]),CALCULATE(SUM(Sales[Revenue]),ALLSELECTED(Sales))
)
RETURN
IF(
ISINSCOPE(Sales[Retailer type]),
DIVIDE(RevenueForCurrentSelection,TotalRevenue),
1
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For the first node I need to show absolute value.
I am using it in decomposition tree. I cant add another node for this
@fatimaarshd , I would simply create a measure without format function a numeric value
and then use % in meausre tool create % column
Or you can choose the format from the measure tool
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 37 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |