Forum Discussion

acg's avatar
acg
Resolver I
3 years ago
Solved

Create Filter from Columntitle

Hi,    I have 6 different Customer types for 800 different entities over 4 years. For each entity the Customer Types sum up to 100%, and I have worked out the actual numbers of customers for each C...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi acg ,

     

    According to your statement, I think you want to show lines dynamicly by filter. One workaround is to UNPIVOT the columns that you need to make the column headers into one column and add it into Legend.

    Or you can create a DimColumn header table and create a measure to achieve your goal.

    Dim Column Header = {
        ("Full Time", 0),
        ("Non-Resident",  1),
        ("Other",  2),
        ("Part-Time",  3),
        ("Resident",4),
        ("Saisonal",  5)
    }

    Measure:

    BS_Details_Last13Months =
    VAR _1 =
        CALCULATE ( SUM ( 'Table'[Resident] ) )
    VAR _2 =
        SUM ( 'Table'[Non-Resident] )
    VAR _3 =
        SUM ( 'Table'[Saisonal] )
    VAR _4 =
        SUM ( 'Table'[Full Time] )
    VAR _5 =
        SUM ( 'Table'[Part-Time] )
    VAR _6 =
        SUM ( 'Table'[Other] )
    VAR _PARAMETER =
        VALUES ( 'Dim Column Header'[Value1] )
    RETURN
        SWITCH (
            TRUE (),
            "Resident" IN _PARAMETER, _1,
            "Non-Resident" IN _PARAMETER, _2,
            "Saisonal" IN _PARAMETER, _3,
            "Full Time" IN _PARAMETER, _4,
            "Part-Time" IN _PARAMETER, _5,
            "Other" IN _PARAMETER, _6
        )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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