Forum Discussion

rmcgrath's avatar
rmcgrath
Advocate III
1 year ago
Solved

x-Axis condition

*My company normally uses a YEAR+WEEK (52 or 53) format for the X-axis in charts.  So, for example:  202400 to 202452

*When the X-axis is set to AUTO, I am getting things like 202460, 202480

 

*Can I control this with the conditional formatting to only display (YEAR)00 through (YEAR)52 (or 53)?

*A screenshot of what happens when I select 2023 and 2024:

 

  • Hi rmcgrath 

     

    Or you can try other format also for year week number

     

    WeekNoYear = 
    VAR YearNum = YEAR('YourTableName'[Client Invoice Date]) // Get the year
    VAR WeekNum = WEEKNUM('YourTableName'[Client Invoice Date], 2) // Get week number (Monday as first day of the week)
    RETURN
    YearNum & "-" & FORMAT(WeekNum, "00")

     

    I hope above format would also work for you!

     

     

  • So I don't think it is a format issue...I think it is an "interval issue".  What I need is some sort of way to "jump" from 20xx60 to 20xx00, essentially eliminating 20xx80.  I wonder if there is some sort of measure to do this?

4 Replies

  • Uzi2019's avatar
    Uzi2019
    Community Champion

    Hi rmcgrath 

     

    There is mistake in your X axis column. 

    You column value should be like this.

     

     

     

    You have to correct your year+week column.

    it should be start with 202301 - and end with 202353

    it should not go 54 and above.

     

    use below formula for your calculated column:

     

    Column = Year(table[date])&WeekNum([date],2)

     

    make sure to convert it ot whole number

     

    I hope I answered your question!

     

     

     

    • Uzi2019's avatar
      Uzi2019
      Community Champion

      Hi rmcgrath 

       

      Or you can try other format also for year week number

       

      WeekNoYear = 
      VAR YearNum = YEAR('YourTableName'[Client Invoice Date]) // Get the year
      VAR WeekNum = WEEKNUM('YourTableName'[Client Invoice Date], 2) // Get week number (Monday as first day of the week)
      RETURN
      YearNum & "-" & FORMAT(WeekNum, "00")

       

      I hope above format would also work for you!

       

       

      • rmcgrath's avatar
        rmcgrath
        Advocate III

        So I don't think it is a format issue...I think it is an "interval issue".  What I need is some sort of way to "jump" from 20xx60 to 20xx00, essentially eliminating 20xx80.  I wonder if there is some sort of measure to do this?

    • rmcgrath's avatar
      rmcgrath
      Advocate III

      So, I think the column is fine.  When I check it in Table View, it does not go past 52 (or 53).  The problem is occurring when more than one year is selected.  Like my example for selecting 2023 and 2024, the Auto feature is putting things like 202360 and 202380 before it goes on to 2024.  I'm guessing that's because it does it in increments of 20 or something?  What I would like it to do is stop at 202352 and then go on to 2024.  I think it would be fine if it even did 202360, but then move on to 2024.  Does that make sense?