Forum Discussion

Malsha's avatar
Malsha
Helper I
2 years ago

matrix visual columns issue

Hi,
I have created a matrix as below.


I'm using the below measure to get the values for selected dates.

Total Worked Hours =
Var cal =
CALCULATE(
    SUM('timesheet_data'[Hours Worked]),
    'timesheet_data'[Timesheet Job Role Name] IN {"Morning Cleaning", "Janitors", "Window Cleaner", "Duty & Morning", "Supervisor"},
    'timesheet_data'[duration] <> "S",
    'timesheet_data'[duration] <> "H"
)

return
cal

I need to show '0.00' for the blank values which means SUM('timesheet_data'[Hours Worked]) = 0. for that I modified the above measure as below. But it gives 0.00 for all the values without giving correct answers. what's the solution for this and what's the error in my measure.
Any help most appreciated. Many thanks.
Total Worked Hours =
var cal =
CALCULATE(
    SUM('timesheet_data'[Hours Worked]),
    'timesheet_data'[Timesheet Job Role Name] IN {"Morning Cleaning", "Janitors", "Window Cleaner", "Duty & Morning", "Supervisor"},
    'timesheet_data'[duration] <> "S",
    'timesheet_data'[duration] <> "H"
)

var ans = COALESCE(cal, 0.00)

return
ans

 



3 Replies

  • Can you try the following : 

     

    Total Worked Hours =
    var cal =
    CALCULATE(
        SUM('timesheet_data'[Hours Worked]),
        'timesheet_data'[Timesheet Job Role Name] IN {"Morning Cleaning", "Janitors", "Window Cleaner", "Duty & Morning", "Supervisor"},
        'timesheet_data'[duration] <> "S",
        'timesheet_data'[duration] <> "H"
    )
    
    return
    IF(ISBLANK(cal), 0.00, cal)
    • Malsha's avatar
      Malsha
      Helper I

      Hi AmiraBedh,
      I tried that measure but it also gives the 0.00 as value for all the dates.