Forum Discussion
DAX Average with filter
- 7 years ago
Hi Anonymous
Try creating these two measures and place them, for instance, in a card visual. Table1 is the table you show:
AVG_2018 = CALCULATE ( AVERAGE ( Table1[Quant] ), Table1[Year] = 2018 )
AVG_2019 = CALCULATE ( AVERAGE ( Table1[Quant] ), Table1[Year] = 2019 )
Please always show your sample data in text-tabular format in addition to (or instead of) the screen captures. That allows people trying to help to readily copy the data and run a quick test, plus it increases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here.
Hi Anonymous
Try creating these two measures and place them, for instance, in a card visual. Table1 is the table you show:
AVG_2018 = CALCULATE ( AVERAGE ( Table1[Quant] ), Table1[Year] = 2018 )
AVG_2019 = CALCULATE ( AVERAGE ( Table1[Quant] ), Table1[Year] = 2019 )
Please always show your sample data in text-tabular format in addition to (or instead of) the screen captures. That allows people trying to help to readily copy the data and run a quick test, plus it increases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here.
Thanks for your help and your insight about the sample data!
- AlB7 years agoCommunity Champion
Anonymous
A simpler, more scalable, way of doing it:
1. Place Table1[Year] in the rows of a visual matrix
2. Create the following measure and place it in the matrix visual:
Answer_Perc =
AVERAGE( Table1[Quant])With that you'll have one measure that can be used for all years, with the result for each on the rows of the matrix visual