Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Display slicer selection of year and quarter in a card

I have a slicer with Year and Quarter columns in it. I want a measure to display selected values as Year, Quarter if Quarter is filtered otherwise just display year if all quarters are selected like
2019, Q1, Q2, 2018, 2017

shraddha09_0-1626849890894.png

I can display year with below formula:

IF ( ISFILTERED ( 'Reporting Period'[Reporting Year] ),
VAR Applied_Filters = FILTERS ( 'Reporting Period'[Reporting Year] )
VAR Applied_Filters_CSV = CONCATENATEX ( Applied_Filters, 'Reporting Period'[Reporting Year], ", ", 'Reporting Period'[Reporting Year], ASC
)

VAR Applied_Filters_Text = " Reporting year = " & Applied_Filters_CSV
RETURN Applied_Filters_Text
)
 
But struggling to combine quarter selections with it.

Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

I have built a data sample like this:

Date-Year-Quarter sample.PNG

Please try:

Measure = 
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Reporting Quarter] ),
        FILTER (
            'Table',
            'Table'[Reporting Year] = MAX ( 'Table'[Reporting Year] )
                && 'Table'[Reporting Quarter] IN ALLSELECTED ( 'Table'[Reporting Quarter] )
        )
    )
RETURN
    IF (
        _count < 4,
        MAX ( 'Table'[Reporting Year] ) & ","
            & CONCATENATEX (
                ALLSELECTED ( 'Table'[Reporting Quarter] ),
                'Table'[Reporting Quarter],
                ",",
                [Reporting Quarter], ASC
            ),
        MAX ( 'Table'[Reporting Year] )
    )
Final Output = 
VAR _T =
 SUMMARIZE ( ALLSELECTED('Table'), 'Table'[Reporting Year], 'Table'[Reporting Quarter] )
VAR _T2 =
 SUMMARIZE (
 _T,
 [Reporting Year],
 "Combine",[Measure]
 )
RETURN
CONCATENATEX ( _T2, [Combine], ",", [Reporting Year], ASC )

The final output is shown below:

combine selected values.PNG

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

I have built a data sample like this:

Date-Year-Quarter sample.PNG

Please try:

Measure = 
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Reporting Quarter] ),
        FILTER (
            'Table',
            'Table'[Reporting Year] = MAX ( 'Table'[Reporting Year] )
                && 'Table'[Reporting Quarter] IN ALLSELECTED ( 'Table'[Reporting Quarter] )
        )
    )
RETURN
    IF (
        _count < 4,
        MAX ( 'Table'[Reporting Year] ) & ","
            & CONCATENATEX (
                ALLSELECTED ( 'Table'[Reporting Quarter] ),
                'Table'[Reporting Quarter],
                ",",
                [Reporting Quarter], ASC
            ),
        MAX ( 'Table'[Reporting Year] )
    )
Final Output = 
VAR _T =
 SUMMARIZE ( ALLSELECTED('Table'), 'Table'[Reporting Year], 'Table'[Reporting Quarter] )
VAR _T2 =
 SUMMARIZE (
 _T,
 [Reporting Year],
 "Combine",[Measure]
 )
RETURN
CONCATENATEX ( _T2, [Combine], ",", [Reporting Year], ASC )

The final output is shown below:

combine selected values.PNG

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

Anonymous
Not applicable

Thank you for the solution. It definitely needed advanced DAX skills to come up with this solution. Thanks a lot!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.