Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Identify the continuous Increasing Data Points

Hello Experts,

 

I have data points based on a key and date as below-

 

Key            Date           Datapoint

s0012jan    12jan19        15

s0013jan    13jan19        16

s0014jan    14jan19        12

s0015jan     15jan19       13

s0016jan     16jan19        14

s0017jan    17jan19         15

 

I want to highlight the data points if there are 6 consecutive data points which are greater than previous (current data point is greater than previous).

Is it possible in DAX??

 

Thanks.

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous ,

 

Please new measures as below:

check1 =
IF (
    SUM ( Data_4[Datapoint] )
        > CALCULATE (
            SUM ( Data_4[Datapoint] ),
            FILTER ( ALLSELECTED ( Data_4 ), Data_4[Index] = MAX ( Data_4[Index] ) - 1 )
        ),
    1,
    0
)

check2 =
VAR start_index =
    CALCULATE (
        MAX ( Data_4[Index] ),
        FILTER (
            ALLSELECTED ( Data_4 ),
            [check1] = 0
                && Data_4[Index] <= MAX ( Data_4[Index] )
        )
    )
VAR end_index =
    CALCULATE (
        MIN ( Data_4[Index] ),
        FILTER (
            ALLSELECTED ( Data_4 ),
            [check1] = 0
                && Data_4[Index] >= MAX ( Data_4[Index] )
        )
    )
RETURN
    IF (
        [check1] = 1,
        IF (
            end_index <> BLANK (),
            SUMX (
                FILTER (
                    ALLSELECTED ( Data_4 ),
                    Data_4[Index] <= end_index
                        && Data_4[Index] > start_index
                ),
                [check1]
            ),
            SUMX (
                FILTER (
                    ALLSELECTED ( Data_4 ),
                    Data_4[Index] <= MAX ( Data_4[Index] )
                        && Data_4[Index] > start_index
                ),
                [check1]
            )
        )
    )

Add [Check2] into visual level filter to highlight dates having 6 consecutive data points which are greater than previous.

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @Anonymous ,

 

Please new measures as below:

check1 =
IF (
    SUM ( Data_4[Datapoint] )
        > CALCULATE (
            SUM ( Data_4[Datapoint] ),
            FILTER ( ALLSELECTED ( Data_4 ), Data_4[Index] = MAX ( Data_4[Index] ) - 1 )
        ),
    1,
    0
)

check2 =
VAR start_index =
    CALCULATE (
        MAX ( Data_4[Index] ),
        FILTER (
            ALLSELECTED ( Data_4 ),
            [check1] = 0
                && Data_4[Index] <= MAX ( Data_4[Index] )
        )
    )
VAR end_index =
    CALCULATE (
        MIN ( Data_4[Index] ),
        FILTER (
            ALLSELECTED ( Data_4 ),
            [check1] = 0
                && Data_4[Index] >= MAX ( Data_4[Index] )
        )
    )
RETURN
    IF (
        [check1] = 1,
        IF (
            end_index <> BLANK (),
            SUMX (
                FILTER (
                    ALLSELECTED ( Data_4 ),
                    Data_4[Index] <= end_index
                        && Data_4[Index] > start_index
                ),
                [check1]
            ),
            SUMX (
                FILTER (
                    ALLSELECTED ( Data_4 ),
                    Data_4[Index] <= MAX ( Data_4[Index] )
                        && Data_4[Index] > start_index
                ),
                [check1]
            )
        )
    )

Add [Check2] into visual level filter to highlight dates having 6 consecutive data points which are greater than previous.

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-yulgu-msft ,

 

Thank you so much for solution. If possible, can you explain 'start index' , 'stop index' and final loop of the dax.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.