Forum Discussion

hohoow_13's avatar
hohoow_13
Regular Visitor
3 years ago

Plot dynamic average line which changes according to filters

Hi Power BI experts,

I am relatively new to Power BI and desparately need some help.

My data is as follows:

a) I would like to plot a combined bar chart (with line) of the countdistinct of ids in each month-year (ie Jan 2020 - 3, Dec 2020 - 1), where xaxis is month-ear, and yaxis is the discountcount (id). For this, I believe I have to do some FORMAT (Date, "MMM YY"), then do a concat of the YEAR (DATE) and FORMAT (DATE,""MM") as a sortorder, before sorting the MMMYY column using the sortorder.

 

b) For the line, I would like to plot an average line (constant) of the countdistinct of ids across all month-years, where the average line responds to filters selected. For example, in this plot, the average line would be at 15/11 (11 distinct month-year periods) with no filters selected. However, if I filter only 2020 and 2021, the average line should be at 8/5, so on and so forth. This is the part where Im having trouble with.

 

Appreciate your help, thanks so much!

 

1 Reply

  • hohoow_13's avatar
    hohoow_13
    Regular Visitor

    And just to add, my version of Power BI does not have the analytics function to add an average line, so I need to do the calculation on my own and add the line in. Cheers.