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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Datesinperiod between 2 dates

Is there a way to calculate DATESINPERIOD between 2 dates?

e.g.  DATE(2020,03,01) TO DATE(2021,02,28)

 

I currently have a calculation to get 365 days ago from today but I need from 1st March 2020 to 28th February 2021:

01 Annual % Counts = CALCULATE([01 No. of Counts]/[00 Total Delivered],DATESINPERIOD('looker_views lkr_Questionnaire'[Questionnaire_DateTime],today(),-365,Day))
 
Thanks
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Try DatesBetween

 

01 Annual % Counts =
CALCULATE (
[01 No. of Counts] / [00 Total Delivered],
DATESBETWEEN (
'looker_views lkr_Questionnaire'[Questionnaire_DateTime],
DATE(2020,03,01) , DATE(2021,02,28)
)
)

 

 

 

01 Annual % Counts =
VAR a =
    DIVIDE (
        [01 No. of Counts],
        [00 Total Delivered]
    )
RETURN
    CALCULATE (
        a,
        DATESBETWEEN (
            'looker_views lkr_Questionnaire'[Questionnaire_DateTime],
            DATE(2020,03,01) , DATE(2021,02,28)
        )
    )

 

 

https://radacad.com/datesinperiod-vs-datesbetween-dax-time-intelligence-for-power-bi

 

 

Regards,

Harsh Nathani

View solution in original post

1 REPLY 1
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Try DatesBetween

 

01 Annual % Counts =
CALCULATE (
[01 No. of Counts] / [00 Total Delivered],
DATESBETWEEN (
'looker_views lkr_Questionnaire'[Questionnaire_DateTime],
DATE(2020,03,01) , DATE(2021,02,28)
)
)

 

 

 

01 Annual % Counts =
VAR a =
    DIVIDE (
        [01 No. of Counts],
        [00 Total Delivered]
    )
RETURN
    CALCULATE (
        a,
        DATESBETWEEN (
            'looker_views lkr_Questionnaire'[Questionnaire_DateTime],
            DATE(2020,03,01) , DATE(2021,02,28)
        )
    )

 

 

https://radacad.com/datesinperiod-vs-datesbetween-dax-time-intelligence-for-power-bi

 

 

Regards,

Harsh Nathani

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors