Forum Discussion

frittle's avatar
frittle
Helper II
4 years ago
Solved

Count function issue in DAX

Dear Power Bi Community, I'm rather new to Power Bi and facing a counting issue I can't quite explain to myself. Background: I am doing a buffer fill level analysis over time and want to find out ...
  • OwenAuger's avatar
    4 years ago

    Hi there,

    I think the immediate issue is that the measure needs to iterate over combinations of date & timestamp, rather than just timestamp.

     

    You could use GENERATE or CROSSJOIN to create a table with all date/timestamp combinations (within the filter context), since we can't rely on 'Puffer Vergleich' to give us all the combinations.

     

    For example:

    <20 Count =
    COUNTROWS (
        FILTER (
            GENERATE (
                VALUES ( 'Main Date Table'[Datum] ),
                VALUES ( '20 min timestamp'[20 Min timestamps] )
            ),
            [Puffer Füllstand test] = "<20%"
        )
    )

     

    Does this give the expected result? 

     

    For an alternative way of handling this type of calculation, have a look at Dynamic Segmentation on DAX Patterns.

     

    Regards,

    Owen