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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Dax for displaying only dates from selected range on date slicer

Hi Experts,

 

I need help in showing dates only from selected range on the date slicer. 

For example in the following snapshot of my fortnightly report, I expect the report to display only the records highlighted in yellow( as the Period selected is between 8/4/2019 to 5/5/2019)

 

fort_capture.PNG

 

Thanks in advance,

Meena

1 ACCEPTED SOLUTION

Just check if can create two more variables using MINX, MAXX - https://docs.microsoft.com/en-us/dax/minx-function-dax,

Use the filter example and find the min week start date when min week start date > Start_date of the slicer. Same way Max

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

You can try the use of slicer from here

https://medium.com/chandakamit/power-bi-comparing-data-across-date-ranges-36be49b68613

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Thanks @EVEAdmin  and @amitchandak for your response.

Though the links are very useful, but i can't figure out how can i implement the solution in my scenario.

So, basically I have a table called 'Emp', that I get employees fortnightly payments from. I created a non related table called 'Dim week ending' with DAX- ALLSELECTED(Emp[Period_end_date]. Then I created a measure to calculate fortnightly payments as following:

Total fortnightly payment =

VAR _lastdate =

    CALCULATE (

        MAX ( 'Dim week ending'[Period End Date] ),

        FILTER (

            ALLSELECTED ( 'Dim week ending'[Period End Date] ),

           'Dim week ending'[Period End Date] < MAX ( 'Dim week ending'[Period End Date])

        )

    )

RETURN

    IF (

        MAX ( 'Dim week ending'[Period End Date] ) <= MAX ( ‘Emp’[Period End Date]),

        CALCULATE (

            SUM ( ‘Emp’ [Amount] ),

            FILTER (

                ALL (‘Emp’ [Period End Date] ),

                ‘Emp’ [Period End Date] <= MAX ( 'Dim week ending'[Period End Date])

                    && ‘Emp’ [Period End Date]> _lastdate

            )

        )

    )

 

I would highly appreciate if you can tell me where to include the logic for displaying only the fortnightly periods selected from the date range slicer.

 

Thanks,

Meena

The table shown in the first example may work like this

 

Measure1 =
var MIN_SLICER_DATE = MIn(Silcer(DATE))
var MAX_SLICER_DATE = MAX(Silcer(DATE))
CALCULATE (

SUM ( ‘Emp’ [Amount] ),

‘Emp’ [Period End Date] >= MIN_SLICER_DATE

&& ‘Emp’ [Period End Date] <=MAX_SLICER_DATE

)

But if the weekend date need to be calculated then more logic is needed 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Just check if can create two more variables using MINX, MAXX - https://docs.microsoft.com/en-us/dax/minx-function-dax,

Use the filter example and find the min week start date when min week start date > Start_date of the slicer. Same way Max

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

thanks @amitchandak , I don't want to disrupt my current logic of fortnight end date. Any way I can include the min & max date seprately? or perhaps merge it with existing logic?

EVEAdmin
Post Patron
Post Patron

I guess this tutorial will be helpful

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.