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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hey Guys,
I need help on shaping a formula in a picture below. Instead of filtering them out by hands in blue table.
I'm trying to count the same value in 'TcodeDesc' as 1 with the filter of same value in 'TimeComponent', when the starting time of 7:00 AM and ending time of 19:00 PM are continuous in column 'DateTimeEnd' and 'DateTimeStart'.
Looking forward to your help.
Regards
Solved! Go to Solution.
Hi @Sukh-ErdeneB ,
Please create these new measures as follows.
ULF Count = CALCULATE( DISTINCTCOUNT('Table'[TimeComponent]), 'Table'[TimeComponent] = "ULF" )OL Count = CALCULATE( DISTINCTCOUNT('Table'[TimeComponent]), 'Table'[TimeComponent] = "OL" )AM Count = CALCULATE( DISTINCTCOUNT('Table'[TimeComponent]), 'Table'[TimeComponent] = "AM" )
Or have a look at these steps in the PQ.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCvYwMDBU0lEKLkksKgHSoT5uSrE6RIhXFpek5uKT8PdBEXfLLErFojw8sSS1iEhxIyDfOT+vpCg/B8hy9MUhga4lOCQo1DkkNMgV1VEgKd/80jy472IB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Unit = _t, TCodeDesc = _t, TimeComponent = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Unit", type text}, {"TCodeDesc", type text}, {"TimeComponent", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"TCodeDesc", "TimeComponent"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[TimeComponent]), "TimeComponent", "Count", List.Sum)
in
#"Pivoted Column"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @Sukh-ErdeneB ,
Please create these new measures as follows.
ULF Count = CALCULATE( DISTINCTCOUNT('Table'[TimeComponent]), 'Table'[TimeComponent] = "ULF" )OL Count = CALCULATE( DISTINCTCOUNT('Table'[TimeComponent]), 'Table'[TimeComponent] = "OL" )AM Count = CALCULATE( DISTINCTCOUNT('Table'[TimeComponent]), 'Table'[TimeComponent] = "AM" )
Or have a look at these steps in the PQ.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCvYwMDBU0lEKLkksKgHSoT5uSrE6RIhXFpek5uKT8PdBEXfLLErFojw8sSS1iEhxIyDfOT+vpCg/B8hy9MUhga4lOCQo1DkkNMgV1VEgKd/80jy472IB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Unit = _t, TCodeDesc = _t, TimeComponent = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Unit", type text}, {"TCodeDesc", type text}, {"TimeComponent", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"TCodeDesc", "TimeComponent"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[TimeComponent]), "TimeComponent", "Count", List.Sum)
in
#"Pivoted Column"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
thank you for your formula. It is great working.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 9 | |
| 7 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 15 | |
| 13 | |
| 11 | |
| 9 |