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.
Hi Power BI Community,
I’m trying to create a bar chart in Power BI to group employees based on their total Work-From-Home (WFH) days into specific ranges ("0 - 2", "3 - 5", "6 - 10", "10+"). The X-axis should show these ranges, and the Y-axis should show how many employees fall into each range. I want the chart to update correctly when I filter by month or year. I’ve followed some steps, but the chart isn’t giving me the results I expect. Can someone please help me fix this?
I have a table named WFH_Data with these columns:
Here’s a sample of my data:
What I Want
I need a bar chart where:
Based on the sample data:
Now I am Getting:
Without Filter | Filtering Jan Month | Filtering Feb Month | |||||
Bucket Range | Employee Count | Bucket Range | Employee Count | Bucket Range | Employee Count | ||
0-2 | 2 | 0-2 | 2 | 0-2 | 0 | ||
3 - 5 | 2 | 3 - 5 | 2 | 3 - 5 | 0 | ||
6 - 10 | 1 | 6 - 10 | 1 | 6 - 10 | 1 | ||
10+ | 0 | 10+ | 0 | 10+ | 0 |
I Want like this:
Without Filter | Filtering Jan Month | Filtering Feb Month | |||||
Bucket Range | Employee Count | Bucket Range | Employee Count | Bucket Range | Employee Count | ||
0-2 | 2 | 0-2 | 3 | 0-2 | 0 | ||
3 - 5 | 2 | 3 - 5 | 2 | 3 - 5 | 1 | ||
6 - 10 | 1 | 6 - 10 | 0 | 6 - 10 | 0 | ||
10+ | 0 | 10+ | 0 | 10+ | 0 |
Solved! Go to Solution.
Hi @UdhayakumarT,
Below are the steps
1. First create summarize table with group by columns ID, Datelist, No of Days New
2. Create Measure to define the bucket list
3. Create static bucketlist tables as below
4. COUNTX(FILTER(VALUES('Bucket List'[emp_id]),[Sum of approved days] >= MIN('Bucket List Table'[Startlimit])&& [Sum of approved days] < MAX('Bucket List Table'[Endlimit])),'Bucket List'[emp_id])
Please use below video from @amitchandak as reference
https://youtu.be/CuczXPj0N-k?si=W_mnUC3YydNcWEx0
Hi @UdhayakumarT,
Below are the steps
1. First create summarize table with group by columns ID, Datelist, No of Days New
2. Create Measure to define the bucket list
3. Create static bucketlist tables as below
4. COUNTX(FILTER(VALUES('Bucket List'[emp_id]),[Sum of approved days] >= MIN('Bucket List Table'[Startlimit])&& [Sum of approved days] < MAX('Bucket List Table'[Endlimit])),'Bucket List'[emp_id])
Please use below video from @amitchandak as reference
https://youtu.be/CuczXPj0N-k?si=W_mnUC3YydNcWEx0
Hi @UdhayakumarT,
Thanks for reaching out to the Microsoft fabric community forum.
The issue arises because the chart is not grouping employees based on their WFH totals within the selected time frame. Instead, it’s calculating total WFH days without properly applying the month/year filters, or it's aggregating across the entire dataset rather than per employee in the current filter context.
The overall thing you need to do to solve the issue is to calculate total WFH days per employee after filters are applied (e.g., January 2025) then classify each employee into a bucket (like “0 - 2”, “3 - 5”, etc.), then count how many employees fall into each bucket. Make sure this logic updates dynamically when slicers (like month/year) are used.
To create a new calculated table use this:
Employee Buckets =
VAR Employees =
SUMMARIZE(
WFH_Data,
WFH_Data[ID],
WFH_Data[Name],
"TotalWFH", CALCULATE(SUM(WFH_Data[No of Days New]))
)
RETURN
ADDCOLUMNS(
Employees,
"Bucket",
SWITCH(
TRUE(),
[TotalWFH] <= 2, "0 - 2",
[TotalWFH] <= 5, "3 - 5",
[TotalWFH] <= 10, "6 - 10",
"10+"
)
)
This table will update based on any slicer/filter applied to Date List. Now use the nbelow to create a measure to count employees per bucket - "Employee Count = COUNTROWS('Employee Buckets')"
Now to create a bar chart in X-Axis use "bucket" from the Employee Bucket table and in Y-Axis use the Employee Count measure. Then add slicers for month/year based on your Date List column or a proper Date table, if you have one.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Best Regards,
Hammad.
Community Support Team
If this post helps then please mark it as a solution, so that other members find it more quickly.
Thank you.
User | Count |
---|---|
84 | |
80 | |
70 | |
47 | |
43 |
User | Count |
---|---|
109 | |
54 | |
50 | |
40 | |
40 |