Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am trying to flag which clients have had the last 3 consecutive months as negative values. My data looks like the table below:
Fields: Client, Date, Value
Client | Feb-20 | Mar-20 | Apr-20 |
Client A | -$100.00 | -$200.00 | -$ 500.00 |
Client B | $500.00 | $120.00 | -$ 800.00 |
Client C | $1,150.00 | $500.00 | $ 900.00 |
The output would be showing me Client A as this meets the criteria.
Client | Feb-20 | Mar-20 | Apr-20 |
Client A | -$100.00 | -$200.00 | -$ 500.00 |
Hi @av9 ,
You can create a measure as below:
Client with 3 consecutive negative months =
CALCULATE (
MAX ( 'Client'[Client] ),
FILTER (
'Client',
'Client'[20-Feb] < 0
&& 'Client'[20-Mar] < 0
&& 'Client'[20-Apr] < 0
)
)
Best Regards
Rena
I have dates setup in a calender table, so it doesn't work in this way
@av9 , try
consecutive negative =
Var _tab =summarize(filter(Table,DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-3,MONTH)),Table[Client],Table[Month],"_1", sum(Table[Value])
return
countX(filter(summarize(_tab,[Client],"_1",if(sum(Table[Value])>0,1,0) ),[_1] >=3),[Client])
I can't quite get the measure to work, I should explain the data model is set up in 3 separate tables:
Client Table(dim), Date Table(dim), Value Table(fact)
Hi @av9 ,
In order to provide you a suitable measure or calculated column, could you please provide some sample data(exclude sensitive data) in these three tables and existed relationships among them? It is better if you can provide your report file directly. Thank you.
Best Regards
Rena
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
80 | |
76 | |
60 | |
36 | |
33 |
User | Count |
---|---|
91 | |
60 | |
59 | |
49 | |
45 |