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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Created date range slicer that gives me + and - 30 days, need help displaying string information

Greetings,

So I Created a date range slicer that gives me + and - 30 days but now I need the tests that were run between those dates.

I have a DATE SLICER and it shows dates in between the DATE SLICER however I am trying to show test that are 30 days prior and after the dates of the DATE SLICER

Most videos use measures or calculations to display however my informatio is a string.

Below is my date range calculation

Then a display of the 60 days forward and backward

Third is my date slicer

Fourth is what I am trying to show versus what is showing. 

 

cCapture1.PNGcCapture2.PNGcCapture3.PNGcCapture4.PNG

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

Hi @Anonymous ,

According to my understanding ,you want to filter table dynamically based on a slicer which date is between 30 days ahead and later, right?

 

You could use the following formula:

 

//create a table lists all date

calenderTable =
CALENDAR (
    MIN ( 'Date Table'[Date Plated] ),
    MAX ( 'Date Table'[Date Plated] )
)

//create date period

dateBetween =
VAR selected =
    MAX ( calenderTable[all date] )
VAR minDate = selected - 30
VAR maxDate = selected + 30
RETURN
    IF (
        SELECTEDVALUE ( 'Date Table'[Date Plated] ) <= maxDate
            && SELECTEDVALUE ( 'Date Table'[Date Plated] ) >= minDate,
        1,
        0
    )

My visualizations look like this after applying filter:

 6.PNG

Is the result what you want? If not, please upload some data samples and expected output.
Please do mask sensitive data before uploading.

 

Best Regards,
Eyelyn Qin

View solution in original post

3 REPLIES 3
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

According to my understanding ,you want to filter table dynamically based on a slicer which date is between 30 days ahead and later, right?

 

You could use the following formula:

 

//create a table lists all date

calenderTable =
CALENDAR (
    MIN ( 'Date Table'[Date Plated] ),
    MAX ( 'Date Table'[Date Plated] )
)

//create date period

dateBetween =
VAR selected =
    MAX ( calenderTable[all date] )
VAR minDate = selected - 30
VAR maxDate = selected + 30
RETURN
    IF (
        SELECTEDVALUE ( 'Date Table'[Date Plated] ) <= maxDate
            && SELECTEDVALUE ( 'Date Table'[Date Plated] ) >= minDate,
        1,
        0
    )

My visualizations look like this after applying filter:

 6.PNG

Is the result what you want? If not, please upload some data samples and expected output.
Please do mask sensitive data before uploading.

 

Best Regards,
Eyelyn Qin

Greg_Deckler
Super User
Super User

@Anonymous - It's hard to say exactly not knowing your source data. You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008

 

Otherwise:

Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , let this approach if want additional dates to be displayed

https://www.youtube.com/watch?v=duMSovyosXE

 

refer if you want every day formula is rolling

Rolling 60 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date]),-60,Day))

Rolling 60 + 60 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date])-60,120,Day))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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