Forum Discussion

snaseem's avatar
snaseem
Helper I
3 years ago
Solved

Counting Spikes in Line Chart

Hi,   I want to compute a measure that shows monthly sales along with threshold showing a line representing X percentage of the largest value for sales amount.   Then want to create a spike measu...
  • v-yanjiang-msft's avatar
    3 years ago

    Hi snaseem ,

    According to your description, I create a sample. Threadhold is a measure whose value is 5.5.

    Here's my solution. Create a measure.

    Count =
    VAR _Check =
        ADDCOLUMNS (
            'Table',
            "Check",
                IF (
                    'Table'[Sales] <= [Threadhold]
                        &&
                        VAR _NEXT =
                            MINX (
                                FILTER ( 'Table', 'Table'[Date] > EARLIER ( 'Table'[Date] ) ),
                                'Table'[Date]
                            )
                        RETURN
                            MAXX ( FILTER ( 'Table', 'Table'[Date] = _NEXT ), 'Table'[Sales] ) > [Threadhold],
                    1,
                    0
                )
        )
    RETURN
        SUMX ( _Check, [Check] )
    

    Get the correct result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.