Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.