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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hello,
as part of a project I would like to sum a part of a bar chart in Power BI as a percentage of total amount.
This is my data set:
| Enter_date | Stock_date |
| 07-Mar-22 | 07-Mar-22 |
| 07-Mar-22 | 07-Mar-22 |
| 07-Mar-22 | 07-Mar-22 |
| 07-Mar-22 | 07-Mar-22 |
| 07-Mar-22 | 07-Mar-22 |
| 07-Mar-22 | 07-Mar-22 |
| 07-Mar-22 | 07-Mar-22 |
| 04-Mar-22 | 04-Mar-22 |
| 04-Mar-22 | 04-Mar-22 |
| 04-Mar-22 | 07-Mar-22 |
| 04-Mar-22 | 04-Mar-22 |
| 04-Mar-22 | 07-Mar-22 |
| 04-Mar-22 | 04-Mar-22 |
| 04-Mar-22 | 07-Mar-22 |
| 04-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 07-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 03-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 03-Mar-22 | 04-Mar-22 |
| 02-Mar-22 | 03-Mar-22 |
| 02-Mar-22 | 04-Mar-22 |
| 02-Mar-22 | 03-Mar-22 |
| 02-Mar-22 | 03-Mar-22 |
| 02-Mar-22 | 02-Mar-22 |
| 02-Mar-22 | 04-Mar-22 |
| 02-Mar-22 | 04-Mar-22 |
| 02-Mar-22 | 04-Mar-22 |
| 02-Mar-22 | 02-Mar-22 |
| 02-Mar-22 | 02-Mar-22 |
| 02-Mar-22 | 07-Mar-22 |
| 02-Mar-22 | 02-Mar-22 |
| 02-Mar-22 | 03-Mar-22 |
| 02-Mar-22 | 03-Mar-22 |
| 02-Mar-22 | 03-Mar-22 |
| 02-Mar-22 | 02-Mar-22 |
I would like to calculate the date difference in days and show the result in a bar chart. Result would look something like this.
(This is an example, not related to the data given at the beginning of this message)
First I add a column to calculate the day difference between the order date and stock date. Next, I have added a conditional column in the query editor. Based on the outcome of the difference between the two dates, these days are added up and put into a bar chart per category (1, 2, 3, 4.... days).
I don't know if this is the best way to calculate the percentage. If not, please tell me how to do this.
I would like to calculate the sum of the green bar charts as a percentage of the total. How can I do that?
Thanks in advance.
Regards,
Solved! Go to Solution.
@WLFRD , Create a new column
new column =
var _diff = datediff([enter date],[stock date],day)
return
Switch(True() ,
_diff =0, "Resolved on same day" ,
// Add other options
"Other" //default
)
@WLFRD , Create a new column
new column =
var _diff = datediff([enter date],[stock date],day)
return
Switch(True() ,
_diff =0, "Resolved on same day" ,
// Add other options
"Other" //default
)
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 47 | |
| 29 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 89 | |
| 74 | |
| 40 | |
| 26 | |
| 25 |