Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Show Average % in Matrix Visualization using Dax Code

Hi,

I have a below requirements and looking for community assistance,

***Data Type for Year column is “Whole Number”

 

I am trying to get a result using below Dax code and I am getting an error.

 

DIVIDE(CALCULATE(AVERAGE('RAW Data'[Selling Price]),

                             ('RAW Data'[Year]=2018)), (CALCULATE(AVERAGE('RAW Data'[Selling Price]),('RAW Data'[Year]=2017))

Raw Data
YearProductSelling Price
2017A10
2017A20
2017B15
2018B30
2018A10
2019A20
2019A30



First Visulization Matrix Visulization
ProductAverage Selling Price 2017Average Selling Price 2018Average Selling Price 2019
A153025
B1510 

 

Final Result in Matrix Visulization
Product201720182019
ADivide %=Average Selling Price 2018/Average Selling Price 2017Divide %=Average Selling Price 2019/Average Selling Price 2017Divide %=Average Selling Price 2020/Average Selling Price 2019
BDivide %=Average Selling Price 2018/Average Selling Price 2017Divide %=Average Selling Price 2019/Average Selling Price 2017Divide %=Average Selling Price 2020/Average Selling Price 2019
1 ACCEPTED SOLUTION
RobbeVL
Impactful Individual
Impactful Individual

Hi,

 

Easiest was to create 2 measures for this:

 

NxtYear = 
VAR
    NxtYear = (SELECTEDVALUE('Table'[Year]))+1
RETURN
CALCULATE(AVERAGE('Table'[Selling Price]); 'Table'[Year] = NxtYear)

 

Measure = DIVIDE([NxtYear];AVERAGE('Table'[Selling Price]))

 

Let me know if this helpend

View solution in original post

4 REPLIES 4
RobbeVL
Impactful Individual
Impactful Individual

Hi,

 

You made some mistakes in your final expeced result I think?

I cant seem to see any logic in that ? 

Anonymous
Not applicable

Hi Robbe,

Yes you are right.I have changed the Final Result Now.

Final Result in Matrix Visulization
Product201720182019
ADivide %=Average Selling Price 2018/Average Selling Price 2017Divide %=Average Selling Price 2019/Average Selling Price 2018Divide %=Average Selling Price 2020/Average Selling Price 2019
BDivide %=Average Selling Price 2018/Average Selling Price 2017Divide %=Average Selling Price 2019/Average Selling Price 2018Divide %=Average Selling Price 2020/Average Selling Price 2019
RobbeVL
Impactful Individual
Impactful Individual

Hi,

 

Easiest was to create 2 measures for this:

 

NxtYear = 
VAR
    NxtYear = (SELECTEDVALUE('Table'[Year]))+1
RETURN
CALCULATE(AVERAGE('Table'[Selling Price]); 'Table'[Year] = NxtYear)

 

Measure = DIVIDE([NxtYear];AVERAGE('Table'[Selling Price]))

 

Let me know if this helpend

Anonymous
Not applicable

Hi Robbe,

Thank so much it is working fine...you saved my lots of time.

Do you have any suggestion for below fromula? Final result should show  negative sign?

Measure = DIVIDE([NxtYear];AVERAGE('Table'[Selling Price]))

Measure

1.00%

-2.09%

Thanks

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.