Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Scatter Plot with same value column with axis split by attribute

Hi All,   First time poster, long time lurker. A lot of my questions have been answered by other posts, so thanks to the community!   I am working on a dashboard which contains student data.  My...
  • amitchandak's avatar
    2 years ago

    Anonymous , Create two measures, for the selected year /vs last year or this year vs last year. In both cases prefer a separate date/year table.

     

    Measure based on the selected value

     

    This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Year'),'Year'[Year]=max('Year'[Year])))
    Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Year'),'Year'[Year]=max('Year'[Year])-1))

     

    based on today

     

    This year Today =
    var _min = eomonth(today(),-1*month(today()))+1
    var _max = eomonth(_min,12 -1*month(today()) )
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    Last year Today =
    var _max = eomonth(today(),-1*month(today()))
    var _min = eomonth(_max,-12)+1
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

  • Thejeswar's avatar
    2 years ago

    Hi Anonymous ,

    I don't think you can use the same column from the same table in both the axis of a scatter chart. This is because when you add the same column to both the axis it creates a one-to-one mapping between the values in both the axis. 

     

    Moreover, the scattercharts are used to analyze the relation between two numerical values. So having a year (datatype as number) in the axis would most likely result in a one-to-one mapping.

     

    Alternatively, you can create a new column in the same table that would have the year value that want to add to the Y-axis. But I doubt the scalability of this technique. I tried for 2 years, from 2022-2024, I was working. You can give it a try

     

    Regards,