Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi All,
Need some help here as im totally stucked!
I am trying to show the budget vs actual in progress bar using stacked column.
Everything was good but when i have 0 training completed, the stacked column will show 100% achieved and i cant find where is wrong with this.
This is my working:
Hi @LemonKing
I tried your scenario with a sample file and built the progress bar in Power BI. The correct setup is:
1. Achieved % = Actual Capped ÷ Budget
2. Unrealised % = 1 – Achieved %
Where:
1. Actual Used = Cost – Grant (minimum 0, so grant never makes it negative)
2. Actual Capped = MIN(Actual Used, Budget)
3. This logic fixes the issue of showing 100% when Cost = 0. If Budget > 0 and Cost/Grant = 0, Achieved % correctly shows 0%.
4. If Budget = 0 and Cost = 0, the bar goes blank (no false 100%).
5. If overspend happens (Actual > Budget), the value is capped at 100%.
6. In the screenshot below, you can see each department:
I also added tooltips with Budget, Cost, Actual Used, and Actual Capped so you can clearly see how the % is calculated. The overall card (53%) shows the weighted total across all departments.
So, using DIVIDE() in the Achieved % measure is the key difference it avoids divide-by-zero problems that caused your wrong 100% earlier.
Hi Rohit1991,
Many thanks for your reply.
I just tried to change the DAX to your way, it works but there's other issues occurs:
1. When i change the department to those with 0 for budget and with training cost, the realised bar is not showing 100%. Is there any way i can show the realised bar to 100% since its exceeded the budget too (although the budget is 0).
2. I tried to do a budget variance then Target Status to show the status for different status, the Target status is showing exceeded budget when all my budget, training cost, grant is 0. I read online, there's this >>= operator but when i use it, then it show error.
Hi @LemonKing
1. For the % Achieved not showing 100% when the actual is higher than budget >> you can wrap the measure with a MIN(1, …) logic so it never exceeds 100%. Example:
Achieved % =
VAR Ach = [Actual Capped]
VAR Bud = [Budget]
RETURN
IF (
Bud = 0,
BLANK(),
MIN ( 1, DIVIDE ( Ach, Bud ) )
)
2. For your Budget Variance logic, try restructuring it with SWITCH(TRUE()) so it handles each case clearly:
Budget Variance =
VAR Actual = [Actual Capped]
VAR Budget = [Budget]
RETURN
SWITCH (
TRUE(),
ISBLANK ( Budget ), BLANK(),
Actual > Budget, "Exceeded Budget",
Actual = Budget, "Within Budget",
Actual < Budget, "Under Budget"
)
This should solve both the 100% cap issue and the condition check.
Hi Rohit1991,
I have tried the formula that you shared but its not working for both.
1. The achieved% is still showing 0 for situation where i got training cost but without budget. It should be the other way round.
I have tried to change it to Actual>=Budget, "Exceeded Budget", it works for those with cost and no budget as its showing Exceeded Budget but when its all 0 in budget, cost and grant then it show Exceeded Budget too which is wrong and i think its back to the same issue i have in the first time.
User | Count |
---|---|
12 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
27 | |
19 | |
14 | |
11 | |
7 |