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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
EllaJ234
Frequent Visitor

DAX - Between 2 specified dates

Hi all, 

 

I am looking to create a measure that will count the amount of values returned between two dates (1st Jan 2022 - 1st May 2022). However, I can't figure out the correct way. For something like a card it's easy as I can just add a relative time filter to the visual and it's done. But for say if I want a pie chart with the values between the dates mentioned above vs the values between another set of dates (2nd May 2022 - 2nd Aug 2022) I struggle to create the correct measure. 
I've been toying around with this one: 

_During Trial =
CALCULATE(
    DISTINCTCOUNT(Issues[CREATED]),
    DATESBETWEEN(
        'Date'[Date],  
        BLANK(),  
        MAX('Date'[Date])  
    ),
        FILTER(Issues,Issues[CREATED]>TODAY()-X)
)
 
But I don't want Today()-X as that will change as the days go by. I need a static one. I can't seem to enter an actual date in there either (01-01-2022 or 01.01.2022). I'm probably missing something quite straight forward but I can;t figure it out. 
 
It won't let me stack filters either like this: 

  FILTER(jiraissue,jiraissue[CREATED]>=01-01-22 || (jiraissue,jiraissue[CREATED]<=01-05-22 )
 
Any suggestions? Thanks in advance! 
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You can specify a static date using the DATE function, e.g. DATE(2022,5,24).

Your syntax for combining filters is wrong, you don't need to specify the table again, so you could use

FILTER (
    jiraissue,
    jiraissue[CREATED] >= DATE ( 2022, 1, 1 )
        && jiraissue[CREATED] <= DATE ( 2022, 5, 1 )
)

I think you need and nor or for that condition so I changed it to && not ||

 

View solution in original post

1 REPLY 1
johnt75
Super User
Super User

You can specify a static date using the DATE function, e.g. DATE(2022,5,24).

Your syntax for combining filters is wrong, you don't need to specify the table again, so you could use

FILTER (
    jiraissue,
    jiraissue[CREATED] >= DATE ( 2022, 1, 1 )
        && jiraissue[CREATED] <= DATE ( 2022, 5, 1 )
)

I think you need and nor or for that condition so I changed it to && not ||

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.

Top Solution Authors