Using DateADD to get Year + Quarter for graph axis in SSRS


hi guys.

i pulling out hair trying solve this. can not figure out syntax of dateadd function.

i designed chart should have year + quarters on x-axis. e.g 2015-q1, 2015-q2 etc.

i managed years via: =dateadd(dateinterval.quarter,-5, today()) min , =dateadd(dateinterval.quarter,5, today()) max. 2015-01-01, 2016-01-10 .

how outout 2015,2016 etc years?

next thing - how "sub" output quarter? final output like: 2015-q1, 2015-q2 etc?

cheers

you can use datepart(dateinterval.year,today()) year date part. can use datepart(dateinterval.quarter,today()) quarter.

cstr(datepart(dateinterval.year,today()))+"-q"+cstr(datepart(dateinterval.quarter,today())) should year-qx format you're looking for.



SQL Server  >  SQL Server Reporting Services, Power View



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........