Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Dynamic Titles

Hi everyone,

 

I am hoping to lean on your expertise. 

 

My client wants a dynamic title. 

 

In the filter pane they have two filters, but can only select one at a time. The first filter is a list of months. The second filter is a list of week numbers. 

 

If Jan from the month filter is selected: 

 

The text should read:

"In January there have 20 items created".

 

If Week from the week filter is selected:

The text should read:

"In week 4 there have 20 items created".

 

If neither are selected then

The text should read:

"YTD there have 20 items created".

 

 

The month and week filters come from the same 'Date' table. 

 

I have read Chris Webb's blog but struggling to wrap my head around this. 

 

Any help would be extremely appreciated

 

Thanks 

 

Ed

  • Hi Anonymous 

    Create a date table

    date1 =
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2019, 1, 1 ), DATE ( 2020, 6, 30 ) ),
        "year-month", FORMAT ( [Date], "yyyy-mm" ),
        "monthname", FORMAT ( [Date], "Mmm" ),
        "allmonthnamne", FORMAT ( [Date], "Mmmm" ),
        "weeknum", WEEKNUM ( [Date], 2 )
    )
    

    Add columns into slicer

    Create measures and the measure into a slicer

    Measure =
    IF (
        ISFILTERED ( date1[monthname] ),
        "In " & SELECTEDVALUE ( date1[allmonthnamne] ) & " there have 20 items created",
        IF (
            ISFILTERED ( date1[weeknum] ),
            "In Week " & SELECTEDVALUE ( date1[weeknum] ) & " there have 20 items created",
            "YTD there have 20 items created"
        )
    )
    

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

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

    Hi Anonymous 

    Create a date table

    date1 =
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2019, 1, 1 ), DATE ( 2020, 6, 30 ) ),
        "year-month", FORMAT ( [Date], "yyyy-mm" ),
        "monthname", FORMAT ( [Date], "Mmm" ),
        "allmonthnamne", FORMAT ( [Date], "Mmmm" ),
        "weeknum", WEEKNUM ( [Date], 2 )
    )
    

    Add columns into slicer

    Create measures and the measure into a slicer

    Measure =
    IF (
        ISFILTERED ( date1[monthname] ),
        "In " & SELECTEDVALUE ( date1[allmonthnamne] ) & " there have 20 items created",
        IF (
            ISFILTERED ( date1[weeknum] ),
            "In Week " & SELECTEDVALUE ( date1[weeknum] ) & " there have 20 items created",
            "YTD there have 20 items created"
        )
    )
    

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.