Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Countrows to include and display 0 values

Hello PowerBI community,   I did a measure to give a number of status updates per project, for a given period (filter dates). For this I use the COUNTROWS() function and it works well.   No...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Thank you all very much for your answers.

    amitchandaknice one ! I thought it would work but never got a suggestion on-click to see no-data elements for this measure 😕

     

    What finally worked was this :

    Status updates count = VAR statusNb = CALCULATE (
    COUNT ( 'Table'[Status Date] ),
    ALLSELECTED ( 'Table' ),
    VALUES ( 'Table'[Project] )
    )
    RETURN
    IF(statusNb=0, 0, statusNb)
     
    So instead of using countrows(), I am more explicit by using the field "Project", targeting correctly all projects with corresponding names and it gives me even those with 0 counts. It martches with what I egt manually.
    I put this measure in Filters and I locked the filter so it displays only a table with 0 at anytime.
     
    Hope it serves to someone with the same prolem.
    Unfortunately I couldn't find a workaround by using countows().