As shown here in the image the categories that doesn't have value shows the category in the line chart where in it should only show those with values greater than 0, and show 0 values for categories with values that is greater than 1 for example comp1 has values for 2 months the other months will show 0 but for comp 6-10 since it doesn't have value in the other months it should not show:

can this be done in power bi Initial This is a sample of the desired result Desired

I tried using this: CountComp = VAR _cnt = CALCULATE(COUNT(Main_Table[Components]), (Main_Table[Row_Number_Comp] = 1)) RETURN IF(_cnt=0,0,_cnt)

but this shows all values for the other components that is all zero for the other months as well. I need to only show zero values for those with values greater than 0 in the months shown in the graph.

1

There are 1 best solutions below

8
Attie Wagner On

Try changing your dax to this:

Count_Components =
VAR _cnt =
    CALCULATE (
        COUNT ( Main_Table[Components] ),
        ( Main_Table[Row_Number_Comp] = 1 )
    )
RETURN
    DIVIDE( _cnt, _cnt ) * _cnt

Using the above DAX, I was able to replicate what you require:

Result

Is this not what you require?