Forum Discussion

Rockz's avatar
Rockz
Icon for Helper I rankHelper I
2 years ago

How to get Last three working days data when user open the report.

Dear Champions,

 

I need a small help from you. Iam trying to implemet a requriement where the whole report will show Working days and hours data. So in this report am using a date range slicer where user can choose dates by self. when user open the report the data should show last three working days data and user should also be able to move the dates by his choice. How can I achieve this?

 

Thanks for your help in advance!.

2 Replies

  • Uzi2019's avatar
    Uzi2019
    Icon for Community Champion rankCommunity Champion

    Hi Rockz 

     

    you can try relative date slicer. with the help of last 3 days it always show when ever user opens a report.

     

     

     

    user can modify the date like days, week, month and years.

     

     

    but it is not like date range slicer. it wont be possible with date range because at the time of publishing you date seletion will be fixed so it wont be automatic changed to last 3 days when you refresh it.

     

    I hope i answered your question!

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,  Rockz

    Thanks for Uzi2019 reply. If you just use Between Slicer, the current version doesn't support the functionality you want, we can only manually control the date range of Between Slicer at the moment. You can switch to List slicer to realize the effect you want.
    How to dynamically select the default values we ne... - Microsoft Fabric Community

    Way 1:
    Use the custom visual: Preselected Slicer

     

    Flag2 = 
    var _rank=
    SELECTEDVALUE('Table'[Rank])
    VAR _weekday = SELECTEDVALUE('Table'[Weekday])
    var _max_rank=
    MAXX(ALL('Table'),[Rank])
    var _last_three_day = _max_rank - 2
    return
    IF(
        _rank >= _last_three_day && _weekday < 6 ,TRUE(),FALSE())

     


    Way 2:

    Weekday = WEEKDAY([Date], 2) 
    
    Rank = 
    RANKX(
        FILTER(
            'Table',
            'Table'[Weekday] < 6 )
        ,
        'Table'[Date],
        ,
        ASC,
        Skip
    )
    
    Slicer = 
    var _maxRank=
    MAX('Table'[Rank])
    var _last_three_day=
    _maxRank - 2
    return
    IF(
        [Rank] >= _last_three_day ,"Last three Day",
        FORMAT(
            'Table'[Date],"yyyy/mm/dd"))
    
    flag = IF(SELECTEDVALUE('Table'[Weekday]) < 6, 1,0)



    Best Regards,
    Yang

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know.
    Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum