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
likhithar
Helper III
Helper III

How to Calculate the Sales for the selected Month for the Changed Status

Hello Team,

I have Sales Transaction against Customer with Status "Y" or "N" for 202203.
The Status changed against Customer Code in the month 202305.
I want to take the sum of Sales(202305) for Customer Codes for which Status has been changed.It's a Measure.
Here I'm attaching the snapshot for Reference.

likhithar_0-1692720769928.png

My Selected Month is 202305 , I want to calculate Sales only for AB101,AB102 and AB108 because for these Customer Codes in 202203 the status is N.
Help me out on this.
TIA

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@likhithar , Try a measure like 

Measure =

var _max = calculate(lastnonblankvalue(Table[YYYYMM], Max(Table[Status])), filter(all(Table), Table[Customer] = max(Table[Customer Code]) ) )
return
countx(values(Table[Customer Code]), if(_max <>  Max(Table[Status]), Table[Customer Code], blank()) )

 

 

We can add logic of Y and N if needed for current and past status

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

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.