Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

X-axis display all dates in Calendar table

Hello all,

 

I'm quite new in Power BI, and I can't figure out something about my Calendar Table.

I have created a dimension table for the dates, it ranges from 2010 to 2030, as I don't want to update it too soon. I made the relationship with my "Sales" tables.

 

In a "Line and Clustered column chart", when I add a "Count" column, and an "Average" line based of some fields, along the date x axis from the Dimension tables, everything is fine, I just see the dates of the data (it is actually just 12 month of data), so it ranges over 2019-2020.

 

But when I add another line called "Target" which is a measure equal to 90 (90%), therefore independant of any date, the chart displays all dates on the x-axis, from 2010 to 2030, which I kind of understand.

 

How could I prevent the "Target" line from expanding the date axis ? Only by a formula in the "Target" Measure?

 

Thanks a lot for your help

 

  • parry2k's avatar
    parry2k
    6 years ago

    Anonymous change target to this

     

    Target = 
    90 * DIVIDE ( [count measure], [count measure] )

     

    assuming your count measures is as below or it can be any measure that you are showing in your visual

     

    Count Measure = COUNTROWS ( Table )

     

    I would ❤Kudos 🙂 if my solution helped. ?

     

7 Replies

  • Anonymous can you share the DAX expression of Target measure.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Just  Target = 90

      so that would make a horizontal line on the graph.

       

      I'm trying to use a IF with returning FALSE(), but the dates are still there.

      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        Anonymous change target to this

         

        Target = 
        90 * DIVIDE ( [count measure], [count measure] )

         

        assuming your count measures is as below or it can be any measure that you are showing in your visual

         

        Count Measure = COUNTROWS ( Table )

         

        I would ❤Kudos 🙂 if my solution helped. ?

         

  • HI Anonymous ,

     

    It will be nice to have the calculation for your TARGET measure. You can add a filter in your measure calculation to calculate only till the maximum date in your data.

     

    Thanks,

    Pragati