The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have 2 columns, Num Hrs & DayName. How do I count the number of hrs in Num Hrs if DayName = Sunday?
Num Hrs is in Duration format, DayName is Text.
Regards,
Gerry
Solved! Go to Solution.
Hi,
Thanks for the reply. Yeah, SUM is what I meant. I have what I need using - Sunday Hrs = CALCULATE(SUM(CarerActualWork[Num Hrs]),CarerActualWork[DayName] = "Sun")
Thanks anyway.
Gerry
Just filter and sum (I think you mean "sum" instead of "count"):
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Num Hrs", type duration}, {"Day", type text}}), #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Day] = "Sunday")), #"Calculated Sum" = List.Sum(#"Filtered Rows"[Num Hrs]) in #"Calculated Sum"
Hi,
Thanks for the reply. Yeah, SUM is what I meant. I have what I need using - Sunday Hrs = CALCULATE(SUM(CarerActualWork[Num Hrs]),CarerActualWork[DayName] = "Sun")
Thanks anyway.
Gerry
Hi @android1,
Glad to hear the issue is solved. You can accept helpful replies as answers to close this thread.
Thanks,
Lydia Zhang