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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
sandee
Helper I
Helper I

Dynamic DATEFunction

Hi Everyone,

 

i am trying to calculate "Winter sale" and want to build the dynamic "Date" so that power bi calpture that period and give results according to that. 

Below is my DAX, but it is not working, seems that "Date" Measure inside is not accepting same:

 

Winter Sales = VAR LADATE = MAX('Date'[Date])
VAR CYR = YEAR(LADATE)

RETURN
CALCULATE([Sales Amount],KEEPFILTERS(FILTER(ALL('Date'[Date]),
'Date'[Date] >= DATE(CYR,12,01) &&
'Date'[Date] <= DATE(CYR,02,28)
)))
 
DateFunction.PNG
 
i want to show all four seasons sale, only the Winter is remaining. 
2 ACCEPTED SOLUTIONS
selimovd
Super User
Super User

Hey @sandee ,

 

if I understand it right the winter sales should just cover the sales in December, January and February, correct?

In this case I would just filter to these months. Check if the following measure would work:

Winter Sales =
CALCULATE(
    [Sales Amount],
    MONTH( 'Date'[Date] )
        IN {
        12,
        1,
        2
    }
)

 

Also be aware that your approach wouldn't cover February 29th in a leap year.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

View solution in original post

Hi Selimovd,

 

this is incredible, you made this DAX very easy , i was working on filter condition on ">= && "<=". and was trying to work on "Date" dax  so that i can enter the proper format. but it was not accepting same. 

View solution in original post

4 REPLIES 4
selimovd
Super User
Super User

Hey @sandee ,

 

if I understand it right the winter sales should just cover the sales in December, January and February, correct?

In this case I would just filter to these months. Check if the following measure would work:

Winter Sales =
CALCULATE(
    [Sales Amount],
    MONTH( 'Date'[Date] )
        IN {
        12,
        1,
        2
    }
)

 

Also be aware that your approach wouldn't cover February 29th in a leap year.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

My Solution :

sandee_0-1623769402511.png

thnaks Selimovd....

Hey @sandee ,

 

I'm happy it worked 🙂

That's also normal, many times I was thinking way too complicated. But when you write more DAX thing will get easier. Keep going 🙂

 

Have fun and best regards

Denis

 

Hi Selimovd,

 

this is incredible, you made this DAX very easy , i was working on filter condition on ">= && "<=". and was trying to work on "Date" dax  so that i can enter the proper format. but it was not accepting same. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.