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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
av9
Helper III
Helper III

How to display clients which have had 3 consecutive negative months in values

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

 

ClientFeb-20Mar-20Apr-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.

ClientFeb-20Mar-20Apr-20
Client A-$100.00-$200.00-$ 500.00
5 REPLIES 5
Anonymous
Not applicable

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
    )
)

negative values for last 3 months.JPG

Best Regards

Rena

I have dates setup in a calender table, so it doesn't work in this way

amitchandak
Super User
Super User

@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])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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)

Anonymous
Not applicable

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.