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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Bitech
New Member

Calculate sales for 1st 3 months based on Current month Sales

I have situation here where I have sales amount only for current month. We have a measure Var_Sales which calculates this Total_Sales amount and replaces for the whole year 

 

Var_Sales = calculate(sum([Total_Sales]), ( ALL('Time'[Year],'Time'[Month]))

 

MonthTotal_SalesVar_Sales
10100000
20100000
30100000
40100000
50100000
60100000
70100000
80100000
90100000
100100000
11100000100000
120100000

 

 

I have a requirement where i need this values to only populate for 1st three months(quarter) in the measure itself.

I tried below dax but getting the values to 0

Var_Sales = calculate(sum([Total_Sales]), ( ALL('Time'[Year],'Time'[Month]))

3months= calculate(VAR_SALES, FILTER('TIME,Time'[Month])<4)

 

What i need is as below

 

MonthToota_SalesVar_Sales3months
10100000100000
20100000100000
30100000100000
401000000
501000000
601000000
701000000
801000000
901000000
1001000000
111000001000000
1201000000
4 REPLIES 4
VahidDM
Super User
Super User

Hi @Bitech 

 

Try this:

Column = 
Var _Sales = calculate(sum(Table[Total_Sales]), ALL(Table))
Var _MaxM = Max(Table[Month])

return
If(_MaxM<=3,_Sales,0)

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Bitech
New Member

This didnt  work , here 

Total_Sales is a measure and it does not have month in it
amitchandak
Super User
Super User

@Bitech , Assuming var sales is a measure try a measure

 


Measure =
var _1 = minx(allselected(Table) , Table[Month])
return
calculate([Var_Sales], filter(Table, Table[Month] <= _1 +3))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  Here Var_Sales is a measure and Month is in Time measure. not able to use allslected function here

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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