Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I have a table Name Operator with below Columns
1. Date
2. Shift
3. Start Time
4. Operator Name
5. Equipment
I need help to calculate following
1. Get Minimum Start Time based on Operator Name and Equipment selection in slicer,
2. From the calculated Minimum Start Time need to Extract the hour from it in format "H AM/MP"(1 AM,2 PM)
3. After Extract the Hour need to get the distict count of date for each derived Hour in above step
4. I need to know how to plot the Derived Hour in X axis on bar chart (which not accepting Measure)
Solved! Go to Solution.
@BalajiS193 , For first one you can create a measure
MinStartTime =
CALCULATE(
MIN('Name Operator'[Start Time]),
ALLSELECTED('Name Operator'),
VALUES('Name Operator'[Operator Name]),
VALUES('Name Operator'[Equipment])
)
Then you can create a calculated column to extract the hour format create a measure
HourFormat =
FORMAT(
'Name Operator'[Start Time],
"h AM/PM"
)
And for Hour need to get the distict count of date for each derived Hour in above step
DistinctDateCount =
CALCULATE(
DISTINCTCOUNT('Name Operator'[Date]),
ALLEXCEPT('Name Operator', 'Name Operator'[HourFormat])
)
To plot chart use hour format column in X- axis and Distinct date count in Y-axis
Proud to be a Super User! |
|
To extract hour from calculated minimum starttime in first step not on the actual start time :
First create a measure for MinStartTime
MinStartTime =
CALCULATE(
MIN('Operator'[Start Time]),
ALLEXCEPT('Operator', 'Operator'[Operator Name], 'Operator'[Equipment])
)
Second extract hour
HourAMPM =
FORMAT([MinStartTime], "h AM/PM")
Third get the distinct count of dates
DistinctDateCount =
CALCULATE(
DISTINCTCOUNT('Operator'[Date]),
ALLEXCEPT('Operator', 'Operator'[Operator Name], 'Operator'[Equipment], 'Operator'[HourAMPM])
)
Create a calculated column for Derived hour as Power BI does not accept measure in X-axis
DerivedHour =
FORMAT('Operator'[Start Time], "h AM/PM")
Then use Derivedhour and Distinct datecount in Bar chart
Proud to be a Super User! |
|
I've tested your solution. However, the HourFormat in calculated column doesn't dynamically update with slicers, and if i create it as calculated measure can't be used within the ALLEXCEPT function.
HourFormat =
FORMAT(
'Name Operator'[Start Time],
"h AM/PM"
)
Do you have any other option to achive the scenario ?
Operator Name and Equipment is used in slicer so it will keep on change so calculate column is not updating for new calculated measure om slicer change
Thanks for your solution let me check
Any solution for the above request ?
@BalajiS193 , For first one you can create a measure
MinStartTime =
CALCULATE(
MIN('Name Operator'[Start Time]),
ALLSELECTED('Name Operator'),
VALUES('Name Operator'[Operator Name]),
VALUES('Name Operator'[Equipment])
)
Then you can create a calculated column to extract the hour format create a measure
HourFormat =
FORMAT(
'Name Operator'[Start Time],
"h AM/PM"
)
And for Hour need to get the distict count of date for each derived Hour in above step
DistinctDateCount =
CALCULATE(
DISTINCTCOUNT('Name Operator'[Date]),
ALLEXCEPT('Name Operator', 'Name Operator'[HourFormat])
)
To plot chart use hour format column in X- axis and Distinct date count in Y-axis
Proud to be a Super User! |
|
Thanks for the reply
actualy i need to extract hour from calculated minimum starttime in first step not on the actual start time in the table and will the calculated column update base on slicer change ?
Need to achive simlar to below query
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
81 | |
52 | |
39 | |
35 |
User | Count |
---|---|
95 | |
79 | |
52 | |
49 | |
47 |