Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Solved! Go to Solution.
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.
Best regards,
Yuliana Gu
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.
Best regards,
Yuliana Gu
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 35 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |