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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Tihannah
Resolver I
Resolver I

Creating Pay Period Start and End Dates from Calendar Table?

I have my main calendar table but would like to create a slicer based on Pay Period Start and End dates. Specifically to show both as one column, i.e.  11/17/23 - 11/30/23 (which is an actual pay period date range) and can be put into a dropdown filter for selection. I've looked and looked, but can't seem to find an example of this in any previously posted questions. Any help would be much appreciated!

1 ACCEPTED SOLUTION
v-jianpeng-msft
Community Support
Community Support

Hi, @Tihannah 

Thanks@JamesFR06 and @lbendlin, I have the following additions. Based on your description, I use the following sample data:

vjianpengmsft_0-1709886658142.png

I created a slicer with date and set the slicer style to between:

vjianpengmsft_1-1709886826909.png

I stitched together the maximum and minimum values in the slicer into a single line with the following DAX:

 

MEASURE =
VAR _start =
    CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) )
VAR _End =
    CALCULATE ( MAX ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) )
RETURN
    _start & "-" & _End

 

Select different start and end dates through slicer for dynamic splicing:

vjianpengmsft_2-1709887039164.png

 

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
v-jianpeng-msft
Community Support
Community Support

Hi, @Tihannah 

Thanks@JamesFR06 and @lbendlin, I have the following additions. Based on your description, I use the following sample data:

vjianpengmsft_0-1709886658142.png

I created a slicer with date and set the slicer style to between:

vjianpengmsft_1-1709886826909.png

I stitched together the maximum and minimum values in the slicer into a single line with the following DAX:

 

MEASURE =
VAR _start =
    CALCULATE ( MIN ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) )
VAR _End =
    CALCULATE ( MAX ( 'Date'[Date] ), ALLSELECTED ( 'Date' ) )
RETURN
    _start & "-" & _End

 

Select different start and end dates through slicer for dynamic splicing:

vjianpengmsft_2-1709887039164.png

 

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

JamesFR06
Resolver IV
Resolver IV

HI

 

I did it 2 times

The first one with a filter on date on filter panel

The second one, i have created a second date table ofr the required period and linked it to my date table

Are these pay periods depending on any user supplied filters?  If not then there is no point in trying to compute them over and over again.  Use an external reference table.

No. They will be the only filter on the dashboard.  @JamesFR06  is there supposed to be an attachment or link to your post? 

No just to tell you how i ve managed the tips

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.