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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
archerjayden
Helper I
Helper I

Show Current Year-Quarters and Past Year/Future Year wise

I want to display Year & Quarter in same axis for my Clustered Column chart however only when it is current year and for remaining past and future years It should display only year value..

 

Is this possible via DAX I am using DirectQuery connecting to SQL server on premise

 

Also have fiscal date calendar table which will have from date,week,month,quarter & year information

 

DataDataDesired ResultDesired Result

Thanks in Advance

Archer

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @archerjayden 

 

You can add a column to your date table something like.

Column = 
IF( 
    'Calendar'[CalendarYear] = YEAR( TODAY() ),
    'Calendar'[CalendarQuarter],
    'Calendar'[CalendarYear] 
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn




View solution in original post

5 REPLIES 5
Mariusz
Community Champion
Community Champion

Hi @archerjayden 

 

You can add a column to your date table something like.

Column = 
IF( 
    'Calendar'[CalendarYear] = YEAR( TODAY() ),
    'Calendar'[CalendarQuarter],
    'Calendar'[CalendarYear] 
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn




Thanks for your tip ... it worked but how do I sort this data unable to figure it out

 

Cost Benefit PBI 2.png

Hi @archerjayden 

 

You can add a sort column 

Column = 
IF( 
    'Calendar'[CalendarYear] = YEAR( TODAY() ),
    ( 'Calendar'[CalendarYear] * 10 ) + 'Calendar'[CalendarQuarter],
    'Calendar'[CalendarYear] * 10
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

Great thanks a lot for your solution 

Column = 
IF( 
    'Calendar'[CalendarYear] = YEAR( TODAY() ),
    ( 'Calendar'[CalendarYear]) + " - Q" + 'Calendar'[CalendarQuarter],
    'Calendar'[CalendarYear]
)

When I try the above to label it properly it throws an error 

"Expressions that yield variant data-type cannot be used to define calculated columns" 

How can I handle this to show 2020-Q1

Okay I have figured this out by converting the number columns to text from PowerQuery and then it did let me create calculated column .. Phew and Yay !

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.