Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

show max date slicer in button

Hello all,

 

I've followed this great article using Custom Range Date Slicer in Power BI with dynamic defaults and more... (linkedin.com).

 

The slicer works well, however there's a blank button which value is calculated by below measure. The _start is calculated and shown correctly and changes with the slicer. The _end however does show the max date of my date table and not the end date filtered by the slicer.

 

The slicer itself works well and my report is showing the correct data based on the slicer. Instead of MAX I've also tried LASTDATE to no avail. Can someone help me with this?

 

ButtonLabel = 
    VAR _selectedperiod = SELECTEDVALUE(SpecialDates[Period])
    VAR _start = MIN(SpecialDates[Date])
    VAR _end = MAX(SpecialDates[Date])
    RETURN SWITCH(true,
        _selectedperiod = "Custom...",FORMAT(_start,"d mmm")&" - "&FORMAT(_end,"d mmm")&" ✎", 
        _selectedperiod = "Today", FORMAT(_start,"d mmm yyyy") ,
        _selectedperiod = "Yesterday", FORMAT(_start,"d mmm yyyy") ,
        FORMAT(_start,"d mmm")&" - "&FORMAT(_end,"d mmm") 
    )

 

Thnx Remco

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi username

    Please modify your formula with the calculated table below .

    I have attached my pbix file , you can refer to it .

     

    Best Regard

    Community Support Team _ Ailsa Tao

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi username

    Please modify your formula with the calculated table below .

    I have attached my pbix file , you can refer to it .

     

    Best Regard

    Community Support Team _ Ailsa Tao

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