Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
I can display year with below formula:
Thank you!
Solved! Go to Solution.
Hi @Anonymous ,
I have built a data sample like this:
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:
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.
Hi @Anonymous ,
I have built a data sample like this:
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:
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.
Thank you for the solution. It definitely needed advanced DAX skills to come up with this solution. Thanks a lot!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 67 | |
| 62 |