Forum Discussion

vbabka's avatar
vbabka
Regular Visitor
4 years ago

Title Based on Field value with measures - error

Hello everyone,

 

i would like to ask you for help.

 

I am using Titles based on Field values to show actual or selected month (code found here - what a superb forum).

 

It is working ok for 3 of my sheets in dashboard, but now i connect new table (UnusedVacation) and for this new one it is not working.

Manually selected month it shows ok in both Title and the Value, but when no month is selected, it returns actual year_month value in title, but do not filter the value shown. 

I guess problem might be in connection, but couldn´t figure it out 😞

 

I am attaching code for the title value and screen of table connections:

List of Year_Month values =
VAR __DISTINCT_VALUES_COUNT = DISTINCTCOUNT('Headcount'[Year_Month])
VAR __MAX_VALUES_TO_SHOW = 7
RETURN
IF(ISFILTERED(Headcount[Year_Month]),

    IF(
        __DISTINCT_VALUES_COUNT > __MAX_VALUES_TO_SHOW,
        CONCATENATE(
 
            CONCATENATEX(
                TOPN(
                    __MAX_VALUES_TO_SHOW,
                    VALUES('Headcount'[Year_Month]),
                    'Headcount'[Year_Month],
                    ASC
                ),
                'Headcount'[Year_Month],
                ", ",
                'Headcount'[Year_Month],
                ASC
            ),
            ", etc."
        ),
 
        CONCATENATEX(
            VALUES('Headcount'[Year_Month]),
            'Headcount'[Year_Month],
            ", ",
            'Headcount'[Year_Month],
            ASC
        )
    ),Headcount[MaxYM])
 
Tables connections (Unused vacation table is where problem is)
When NO Year_Month manually selected (error)

If Year_Month IS manually selected - OK

 

Vojtech Babka

 

2 Replies

  • sturlaws's avatar
    sturlaws
    Icon for Resident Rockstar rankResident Rockstar

    Hi,

     

    is the problem that the title is wrong, or that the table is not filtered for the date in that appears in the title?


    Cheers,
    Sturla

  • vbabka's avatar
    vbabka
    Regular Visitor

    Hello - B is correct 🙂 

    Title shows correct date in all options, if i filter manually onleft side, title and table get filtered correctly, but if no Year_Month is selected, title shows highest Year_Month (actual - which is correct), but do not filter the table.

    In other sheets/tables (e.g. Presence or Absence) it is working well.