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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SYM1986
Helper I
Helper I

How to use measure to decide consecutive decrease

DATEManagerSale valueProfit
2021-01-01A1000500
2021-01-01B2000600
2021-01-01C500100
2021-01-05A1000500
2021-01-05B2000600
2021-01-05C3000400
2021-01-10A1000300
2021-01-10B1000200
2021-01-10C1000500
2021-01-18A3000600
2021-01-18B1000400
2021-01-18C3000300

 

Hi all,

I have a report like above, and edited in power bi.

I created the 1st measure called  rate of profit(=profit/sales values x 100%) .

I want to alert when the measure(rate of profit) continuosly decreasing over date.( Maybe 3 consecutive decreasement over days of the table) And the date is not consecutive.

By now, i think i can make 2nd measure to decide if there are  3 consecutive decreasement on the measure(rate of profit), and the 2nd measure can be used in visual to show just like traffic light.

Can anyone help me this? Thanks 

2 REPLIES 2
lbendlin
Super User
Super User

This is a pretty standard "previous row"  pattern.  You will need to define what "previous row"  means in your situation.  Assuming that you want to see this by manager, sorted by date, here is one implementation:

 

lbendlin_0-1611871524885.png

 

Trend =
var m = SELECTEDVALUE(Performance[Manager])
var d = SELECTEDVALUE(Performance[DATE])
var dp = CALCULATE(max(Performance[DATE]),Performance[Manager]=m,Performance[DATE]<d)
var p = CALCULATE([Rate of Profit],Performance[Manager]=m,Performance[DATE]=dp)
return switch(TRUE(),[Rate of Profit]>p,"Up",[Rate of Profit]<p,"Down","Same")

Hi @lbendlin ,Thank you very much. It's almost what i want, still have a little question in the lastest step.

    Return switch(TRUE(),[Rate of Profit]>p,"Up",[Rate of Profit]<p,"Down","Same")

To this step, what i want is decided by date, for example

If (and([the Rate of profit] in the lastest day> [the Rate of profit] in the 2nd lastest day,[the Rate of profit] in the 2nd lastest day>[the Rate of profit] in the 3nd lastest day),‘up’,'noramal')

so i don't know how to get the 2nd and 3rd lastest day from datasource by using dax.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.