Forum Discussion
Create Filter from Columntitle
- Anonymous3 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 ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
As the table is massive, is there a better solution than this one? https://community.powerbi.com/t5/Desktop/Filtering-by-column-headings/m-p/54080 ?
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.