Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Date Default selection till Yesterday

Hi Power Community,

 

I have a date filed in Fact table wihich continas data since 2005 till yesterday.

For filtering purpose I am using Date dimention which contians 2005 till 2025. here when ever user open report user should see data in current year till yersterday.

 

The Slicer also shoud show only the curreent year(till yesterday not entire year 01/01/2020 - 05/11/2020) as default selection.

 

PLease sugget me solution its a showstiopper for me since a two days.

 

Thanks.

  • Hi, Anonymous 

    According to your description, you want the data, and Slicer both show only the current year till yesterday. If you just want to show data from the current year till yesterday, you can try this measure:

    Measure =
    
    CALCULATE(MAX([Amount]),FILTER('Table',YEAR([Date])=YEAR(TODAY())&&[Date]<=TODAY()-1))

    And place the measure to the chart, like this:

       

    If you want to set default value for a Slicer, I think that you can try the Power Slicer . It’s a custom visual which supports adding default value to Slicer using JavaScript. You can download it and try to figure out how to realize it.

     

    Best Regards,

    Community Support Team _Robert Qin

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

2 Replies

  • Anonymous , There is workaround .

    Create a column like this and sort it on date and save it on yesterday

    New column in date table

    Date Type = SWITCH(TRUE(),'Date'[Date]=TODAY(),"Today",'Date'[Date]=TODAY()-1,"Yesterday",'Date'[Date]&"")

     

    It has all dates with yesterday and today and sorted on the date to will behave the same. You can use format on date, if needed

     

    Refer my video for steps: https://www.youtube.com/watch?v=hfn05preQYA

     

    Please provide your feedback comments and advice for new videos
    Tutorial Series Dax Vs SQL Direct Query PBI Tips
    Appreciate your Kudos.

  • v-robertq-msft's avatar
    v-robertq-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

    According to your description, you want the data, and Slicer both show only the current year till yesterday. If you just want to show data from the current year till yesterday, you can try this measure:

    Measure =
    
    CALCULATE(MAX([Amount]),FILTER('Table',YEAR([Date])=YEAR(TODAY())&&[Date]<=TODAY()-1))

    And place the measure to the chart, like this:

       

    If you want to set default value for a Slicer, I think that you can try the Power Slicer . It’s a custom visual which supports adding default value to Slicer using JavaScript. You can download it and try to figure out how to realize it.

     

    Best Regards,

    Community Support Team _Robert Qin

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