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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
DeEviloN
Helper III
Helper III

Sales of the current month

Help me please! Now the month is March, I want to display the dynamics of sales, there were no sales this month, they were in February. the CALCULATE(SUM('Свод221'[Количество изделий всего,шт]),DATESMTD('Свод221'[Датавыдачи])) function displays the last month of the sale, not the current March, how do I display March and that the sales are 0? Or can you tell me right away how to compare the current month with the previous one?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@DeEviloN , Ti using today

 

MTD=
var _max = if(day(today() )=1 , eomonth(today(),-1), today())
var _min = eomonth(_max,-1)+1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >= _min && 'Table'[Date] <=_max ) )


LMTD =
var _max1 = if(day(today() )=1 , eomonth(today(),-1), today())
var _max = date(year(_max1),month(_max1)-1, day(_max1))
var _min = eomonth(today(),-2)+1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >= _min && 'Table'[Date] <=_max ) )

 

This month Today =
var _min = eomonth(today(),-1)+1
var _max = eomonth(today(),0) //today()
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >= _min && 'Date'[Date] <=_max ) )

 

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

 

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@DeEviloN , Ti using today

 

MTD=
var _max = if(day(today() )=1 , eomonth(today(),-1), today())
var _min = eomonth(_max,-1)+1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >= _min && 'Table'[Date] <=_max ) )


LMTD =
var _max1 = if(day(today() )=1 , eomonth(today(),-1), today())
var _max = date(year(_max1),month(_max1)-1, day(_max1))
var _min = eomonth(today(),-2)+1

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] >= _min && 'Table'[Date] <=_max ) )

 

This month Today =
var _min = eomonth(today(),-1)+1
var _max = eomonth(today(),0) //today()
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >= _min && 'Date'[Date] <=_max ) )

 

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

 

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

Look what's wrong with the previous month

Безымянный.png

Hi, @DeEviloN 

It's hard to figure out the problem from the screenshot, can you share more details for research?

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors