Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I have a dimension table for time of day (TOD) with 3 options: "1" = day shift, "2" = evening shift, and "3" = night shift.
I frequently chart number of shift per time of day (TOD) based on the "shift codes" logged in our scheduling system. Some shifts (and hence shift codes) span more than one TOD. e.g., "A" shift is 8 hours on day shift and 4 hours on evening shift. The way our scheduling system works is that "A" gets recorded twice:
Entry 1: "A 8 1"
Entry 2: "A 4 2"
The above translates to:
Entry 1: "shift code A, 8 hours on TOD 1"
Entry 1: "shift code A, 4 hours on TOD 2"
An issue I'm facing is that if I simply COUNT instances of 'A' shift I get different answers based on what TOD I'm filtering for. If I'm looking at just TOD =1, then count =1 (desired and correct result). If my slicer is showing TOD 1&2, then count of 'A' is 2 (a misleading result but technically correct math given the data structure). I desire to set my shift count based on what TOD is selected in the slicer, such that if only one TOD is selected (1 OR 2 OR 3) then count as normal, but if TOD selected is (1 AND 2; 2 AND 3; or 1 AND 2 AND 3) then count for 'A' shift should be divided by 2.
I have in the past created a measure that changes value based on a slicer (SELECTEDVALUE and SWITCH functions using a disconnected table). However, I'm unclear how to do this with multiple selected values.
Is this possible? Thanks!
@Anonymous ,
Based on what I got
Power Query - 1. Split into columns by delimiters :
2. In the second column remove " , replace with an empty string
3. Split into columns by delimiters - Space
now you can use these new columns as per need
Split Column Power Query: https://youtu.be/FyO9Vmhcfag
Power Query Replace Value: https://youtu.be/hkZhZbR7Kmk
Hi @amitchandak , thanks for the reply.
If I'm understanding correctly, you're suggesting a change to how my columns are set up to somehow make the math work. Is that right? If so, can you please expand on what the logic is?
I'm afraid I'm not seeing how it will help with the fact that there are two rows showing "A" and therefore counts as 2 instances of "A" instead of just 1.
Thanks for your time!
User | Count |
---|---|
98 | |
90 | |
82 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
67 |