Forum Discussion

Sonnet's avatar
Sonnet
Icon for Helper I rankHelper I
2 years ago

Stacked Bar Chart not showing correct values

Hi all, I have an issue. I have a stacked bar having on X axis Semester by Year from the Calendar Table, on the Y axis a measure that counts the current open risks based on the Risk Table. In the legend, Current Rating from the Risk Table.

 

The issue is that the rating changes whenever there is a change in the Current Rating in the Risk Table each semester instead of keeping the actual count each semester.


Here an example of the tables:

Risk Table

Risk Id Creation DateCurrent Rating for current semester
430/06/2023Medium
130/06/2022High
231/12/2022Low
330/06/2023Medium

 

Manually, every semester the current Rating for current semester is substitute with a new rating, and the old rating is stored in the Rating Table:

Risk IdSemester DateRating
130/06/2022Low
131/12/2022Medium
231/12/2022Low
230/06/2023High
330/06/2023Medium
331/12/2023Medium
430/06/2023Medium

If I use the Rating column from the Rating table in the legend, I get this:

 

 

On the data model side, the Calendar Date joins the Risk rating and the Risk table, and the Risk Rating actively joins the Risk table on the Risk Id.

Any help is much appreaciated.

2 Replies

  • Sonnet , I think calendar should join to risk Rating and Risk should also join to risk rating

     

    Try meausre like

     

    Count of Risks by Historical Rating =
    CALCULATE(
    COUNTROWS('Rating'),
    FILTER(
    'Rating Rating',
    'Rating Rating'[Risk Id] = 'Rating'[Risk Id]
    && 'Rating Rating'[Semester Date] <= MAX('Calendar Table'[Date])
    )
    )

     

     

    • Sonnet's avatar
      Sonnet
      Icon for Helper I rankHelper I

      When using your measure above, at this point:
      'Rating Rating'[Risk Id] = 'Rating'[Risk Id]

      the Rating[Risk Id] is not selectable. Only measures are displayed.

      Any other way to solve it please?