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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
vjnvinod
Impactful Individual
Impactful Individual

Power BI Meausre help (add rows, which calculates varinace)

Hi Team,

 

below is my matrix visual

I  need to create a measure/Calculated coloum to calculate the Variance(Basically Actual minus plan) such that it shows the variance in row.

 

Variance= Actual-plan

below is the selected fields, to ge this visual

 

Capture.PNG

 

let me know if this feasible

 

 

 

1 ACCEPTED SOLUTION

Check the same file again.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

29 REPLIES 29
amitchandak
Super User
Super User

These Actual and planned are dimension members or measures. What are these 1,2,3..9 are .

 

The information you have provided is not making the problem clear to me. Can you please explain with an example. If possible please share a sample pbix file after removing sensitive information.
Thanks.

My Recent Blog -

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

there is no measure, these are  fields

1,2,3,4,5... these are periods

 

basically a row should get created for each category

for instance

in my visual

                                          1         2    3...

hours planned         40     50    80

hours actuals            30     60     20

Var_Hours                   -10    10    -60

 

 

 

If Hour Planned, Hour Actual is the measure then Variance measure can also be part of row. Show row on measure: It seems like you used that property.

 

If now. Share how you made these as dimension members. from that we can suggest

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

They are not Meausres

 

Hour Planned, hour Actual, Time planned, Time actual, Expense planned, Expense Actual, they are my rows, under the coloumn custom, and periods, 1, 2, 3, 4....etc are my coloumns

 

I have used Matrix visualazition to get that visual(I have note used any measure or calculated field used)

now what i need is variance for each of these categories, "Hours", Time", "Expense" as a row

 

below is how my dataset looks like

Capture1.PNG

see below how i used the power BI to get the visual

 

Capture.PNG

 

Try

Table 2 = UNION(
	SUMMARIZE(
	data,data[Eng#.1],"Custom","Hour Variance %"
,"1",(divide(sumx(data,if(data[Custom]="Hours Actuals",[1],0)),sumx(data,if(data[Custom]="Hours Planned",[1],0)),0)-1)
,"2",(divide(sumx(data,if(data[Custom]="Hours Actuals",[2],0)),sumx(data,if(data[Custom]="Hours Planned",[2],0)),0)-1)
,"3",(divide(sumx(data,if(data[Custom]="Hours Actuals",[3],0)),sumx(data,if(data[Custom]="Hours Planned",[3],0)),0)-1)
,"4",(divide(sumx(data,if(data[Custom]="Hours Actuals",[4],0)),sumx(data,if(data[Custom]="Hours Planned",[4],0)),0)-1)
,"5",(divide(sumx(data,if(data[Custom]="Hours Actuals",[5],0)),sumx(data,if(data[Custom]="Hours Planned",[5],0)),0)-1)
,"6",(divide(sumx(data,if(data[Custom]="Hours Actuals",[6],0)),sumx(data,if(data[Custom]="Hours Planned",[6],0)),0)-1)
,"7",(divide(sumx(data,if(data[Custom]="Hours Actuals",[7],0)),sumx(data,if(data[Custom]="Hours Planned",[7],0)),0)-1)
,"8",(divide(sumx(data,if(data[Custom]="Hours Actuals",[8],0)),sumx(data,if(data[Custom]="Hours Planned",[8],0)),0)-1)
,"9",(divide(sumx(data,if(data[Custom]="Hours Actuals",[9],0)),sumx(data,if(data[Custom]="Hours Planned",[9],0)),0)-1)
,"10",(divide(sumx(data,if(data[Custom]="Hours Actuals",[10],0)),sumx(data,if(data[Custom]="Hours Planned",[10],0)),0)-1)
,"11",(divide(sumx(data,if(data[Custom]="Hours Actuals",[11],0)),sumx(data,if(data[Custom]="Hours Planned",[11],0)),0)-1)
,"12",(divide(sumx(data,if(data[Custom]="Hours Actuals",[12],0)),sumx(data,if(data[Custom]="Hours Planned",[12],0)),0)-1)

),	SUMMARIZE(
	data,data[Eng#.1],"Custom","Time Variance %"
,"1",(divide(sumx(data,if(data[Custom]="Time Actuals",[1],0)),sumx(data,if(data[Custom]="Time Planned",[1],0)),0)-1)
,"2",(divide(sumx(data,if(data[Custom]="Time Actuals",[2],0)),sumx(data,if(data[Custom]="Time Planned",[2],0)),0)-1)
,"3",(divide(sumx(data,if(data[Custom]="Time Actuals",[3],0)),sumx(data,if(data[Custom]="Time Planned",[3],0)),0)-1)
,"4",(divide(sumx(data,if(data[Custom]="Time Actuals",[4],0)),sumx(data,if(data[Custom]="Time Planned",[4],0)),0)-1)
,"5",(divide(sumx(data,if(data[Custom]="Time Actuals",[5],0)),sumx(data,if(data[Custom]="Time Planned",[5],0)),0)-1)
,"6",(divide(sumx(data,if(data[Custom]="Time Actuals",[6],0)),sumx(data,if(data[Custom]="Time Planned",[6],0)),0)-1)
,"7",(divide(sumx(data,if(data[Custom]="Time Actuals",[7],0)),sumx(data,if(data[Custom]="Time Planned",[7],0)),0)-1)
,"8",(divide(sumx(data,if(data[Custom]="Time Actuals",[8],0)),sumx(data,if(data[Custom]="Time Planned",[8],0)),0)-1)
,"9",(divide(sumx(data,if(data[Custom]="Time Actuals",[9],0)),sumx(data,if(data[Custom]="Time Planned",[9],0)),0)-1)
,"10",(divide(sumx(data,if(data[Custom]="Time Actuals",[10],0)),sumx(data,if(data[Custom]="Time Planned",[10],0)),0)-1)
,"11",(divide(sumx(data,if(data[Custom]="Time Actuals",[11],0)),sumx(data,if(data[Custom]="Time Planned",[11],0)),0)-1)
,"12",(divide(sumx(data,if(data[Custom]="Time Actuals",[12],0)),sumx(data,if(data[Custom]="Time Planned",[12],0)),0)-1)

),SUMMARIZE(
	data,data[Eng#.1],"Custom","Expense Variance %"
,"1",(divide(sumx(data,if(data[Custom]="Expense Actuals",[1],0)),sumx(data,if(data[Custom]="Expense Planned",[1],0)),0)-1)
,"2",(divide(sumx(data,if(data[Custom]="Expense Actuals",[2],0)),sumx(data,if(data[Custom]="Expense Planned",[2],0)),0)-1)
,"3",(divide(sumx(data,if(data[Custom]="Expense Actuals",[3],0)),sumx(data,if(data[Custom]="Expense Planned",[3],0)),0)-1)
,"4",(divide(sumx(data,if(data[Custom]="Expense Actuals",[4],0)),sumx(data,if(data[Custom]="Expense Planned",[4],0)),0)-1)
,"5",(divide(sumx(data,if(data[Custom]="Expense Actuals",[5],0)),sumx(data,if(data[Custom]="Expense Planned",[5],0)),0)-1)
,"6",(divide(sumx(data,if(data[Custom]="Expense Actuals",[6],0)),sumx(data,if(data[Custom]="Expense Planned",[6],0)),0)-1)
,"7",(divide(sumx(data,if(data[Custom]="Expense Actuals",[7],0)),sumx(data,if(data[Custom]="Expense Planned",[7],0)),0)-1)
,"8",(divide(sumx(data,if(data[Custom]="Expense Actuals",[8],0)),sumx(data,if(data[Custom]="Expense Planned",[8],0)),0)-1)
,"9",(divide(sumx(data,if(data[Custom]="Expense Actuals",[9],0)),sumx(data,if(data[Custom]="Expense Planned",[9],0)),0)-1)
,"10",(divide(sumx(data,if(data[Custom]="Expense Actuals",[10],0)),sumx(data,if(data[Custom]="Expense Planned",[10],0)),0)-1)
,"11",(divide(sumx(data,if(data[Custom]="Expense Actuals",[11],0)),sumx(data,if(data[Custom]="Expense Planned",[11],0)),0)-1)
,"12",(divide(sumx(data,if(data[Custom]="Expense Actuals",[12],0)),sumx(data,if(data[Custom]="Expense Planned",[12],0)),0)-1)

),
SUMMARIZE(
	data,data[Eng#.1],"Custom","Hour Variance"
,"1",(sumx(data,if(data[Custom]="Hours Actuals",[1],0))- sumx(data,if(data[Custom]="Hours Planned",[1],0)))
,"2",(sumx(data,if(data[Custom]="Hours Actuals",[2],0))- sumx(data,if(data[Custom]="Hours Planned",[2],0)))
,"3",(sumx(data,if(data[Custom]="Hours Actuals",[3],0))- sumx(data,if(data[Custom]="Hours Planned",[3],0)))
,"4",(sumx(data,if(data[Custom]="Hours Actuals",[4],0))- sumx(data,if(data[Custom]="Hours Planned",[4],0)))
,"5",(sumx(data,if(data[Custom]="Hours Actuals",[5],0))- sumx(data,if(data[Custom]="Hours Planned",[5],0)))
,"6",(sumx(data,if(data[Custom]="Hours Actuals",[6],0))- sumx(data,if(data[Custom]="Hours Planned",[6],0)))
,"7",(sumx(data,if(data[Custom]="Hours Actuals",[7],0))- sumx(data,if(data[Custom]="Hours Planned",[7],0)))
,"8",(sumx(data,if(data[Custom]="Hours Actuals",[8],0))- sumx(data,if(data[Custom]="Hours Planned",[8],0)))
,"9",(sumx(data,if(data[Custom]="Hours Actuals",[9],0))- sumx(data,if(data[Custom]="Hours Planned",[9],0)))
,"10",(sumx(data,if(data[Custom]="Hours Actuals",[10],0))- sumx(data,if(data[Custom]="Hours Planned",[10],0)))
,"11",(sumx(data,if(data[Custom]="Hours Actuals",[11],0))- sumx(data,if(data[Custom]="Hours Planned",[11],0)))
,"12",(sumx(data,if(data[Custom]="Hours Actuals",[12],0))- sumx(data,if(data[Custom]="Hours Planned",[12],0)))

),	SUMMARIZE(
	data,data[Eng#.1],"Custom","Time Variance"
,"1",(sumx(data,if(data[Custom]="Time Actuals",[1],0))- sumx(data,if(data[Custom]="Time Planned",[1],0)))
,"2",(sumx(data,if(data[Custom]="Time Actuals",[2],0))- sumx(data,if(data[Custom]="Time Planned",[2],0)))
,"3",(sumx(data,if(data[Custom]="Time Actuals",[3],0))- sumx(data,if(data[Custom]="Time Planned",[3],0)))
,"4",(sumx(data,if(data[Custom]="Time Actuals",[4],0))- sumx(data,if(data[Custom]="Time Planned",[4],0)))
,"5",(sumx(data,if(data[Custom]="Time Actuals",[5],0))- sumx(data,if(data[Custom]="Time Planned",[5],0)))
,"6",(sumx(data,if(data[Custom]="Time Actuals",[6],0))- sumx(data,if(data[Custom]="Time Planned",[6],0)))
,"7",(sumx(data,if(data[Custom]="Time Actuals",[7],0))- sumx(data,if(data[Custom]="Time Planned",[7],0)))
,"8",(sumx(data,if(data[Custom]="Time Actuals",[8],0))- sumx(data,if(data[Custom]="Time Planned",[8],0)))
,"9",(sumx(data,if(data[Custom]="Time Actuals",[9],0))- sumx(data,if(data[Custom]="Time Planned",[9],0)))
,"10",(sumx(data,if(data[Custom]="Time Actuals",[10],0))- sumx(data,if(data[Custom]="Time Planned",[10],0)))
,"11",(sumx(data,if(data[Custom]="Time Actuals",[11],0))- sumx(data,if(data[Custom]="Time Planned",[11],0)))
,"12",(sumx(data,if(data[Custom]="Time Actuals",[12],0))- sumx(data,if(data[Custom]="Time Planned",[12],0)))

),SUMMARIZE(
	data,data[Eng#.1],"Custom","Expense Variance"
,"1",(sumx(data,if(data[Custom]="Expense Actuals",[1],0))- sumx(data,if(data[Custom]="Expense Planned",[1],0)))
,"2",(sumx(data,if(data[Custom]="Expense Actuals",[2],0))- sumx(data,if(data[Custom]="Expense Planned",[2],0)))
,"3",(sumx(data,if(data[Custom]="Expense Actuals",[3],0))- sumx(data,if(data[Custom]="Expense Planned",[3],0)))
,"4",(sumx(data,if(data[Custom]="Expense Actuals",[4],0))- sumx(data,if(data[Custom]="Expense Planned",[4],0)))
,"5",(sumx(data,if(data[Custom]="Expense Actuals",[5],0))- sumx(data,if(data[Custom]="Expense Planned",[5],0)))
,"6",(sumx(data,if(data[Custom]="Expense Actuals",[6],0))- sumx(data,if(data[Custom]="Expense Planned",[6],0)))
,"7",(sumx(data,if(data[Custom]="Expense Actuals",[7],0))- sumx(data,if(data[Custom]="Expense Planned",[7],0)))
,"8",(sumx(data,if(data[Custom]="Expense Actuals",[8],0))- sumx(data,if(data[Custom]="Expense Planned",[8],0)))
,"9",(sumx(data,if(data[Custom]="Expense Actuals",[9],0))- sumx(data,if(data[Custom]="Expense Planned",[9],0)))
,"10",(sumx(data,if(data[Custom]="Expense Actuals",[10],0))- sumx(data,if(data[Custom]="Expense Planned",[10],0)))
,"11",(sumx(data,if(data[Custom]="Expense Actuals",[11],0))- sumx(data,if(data[Custom]="Expense Planned",[11],0)))
,"12",(sumx(data,if(data[Custom]="Expense Actuals",[12],0))- sumx(data,if(data[Custom]="Expense Planned",[12],0)))

),
	SUMMARIZE(
	data,data[Eng#.1],data[Custom]
	,"1",sumx(data,[1])
	,"2",sumx(data,[2])
	,"3",sumx(data,[3])
	,"4",sumx(data,[4])
	,"5",sumx(data,[5])
	,"6",sumx(data,[6])
	,"7",sumx(data,[7])
	,"8",sumx(data,[8])
	,"9",sumx(data,[9])
	,"10",sumx(data,[10])
	,"11",sumx(data,[11])
	,"12",sumx(data,[12])
	)
)
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

this is great, only issue i see is the % format, can you take a look at that?

Wow. I think it is overkill for such a small task. There is a great article by Marco Russo (I think) that talks about write complex DAX or better data model, and this great example of the same. You can surely achieve something by writing DAX but is it worth and can be maintained or time to look at the model and keep things simple and scalable. Just my 2cents


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I agree to @parry2k . This is a overkill. The idle data would be the transpose of this.

That is another way to try.

Then we can create only variance measures and display measures on the row.

 

This is a quick fix solution.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@vjnvinod solution attached

 

Would appreciate Kudos 🙂 if my solution helped.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

vjnvinod
Impactful Individual
Impactful Individual

@parry2k 

 

thanks for sending this through,  i was with my client today , the problem with this model, when someone extract that data into csv/excel,  all the data come up as coloumn, not as row

 

is there any solution to this?

@amitchandak 

 

the measure, you sent actually helps with my requirement, if we can change the formatting of Variance%, it would be great

@vjnvinod 

I assume formatting means multiple by 100. Please check on the same link again.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

its currently showing as number

lets say for instance if its 100, show me in matrix table as 100% and so son

vjnvinod
Impactful Individual
Impactful Individual

@amitchandak 

 

i think i can live without the % symbol

but what i am missing is "total"

 

Now you have , 1,2,3,4...12 but "total" is what is missing

can you bring in that as well into your measure? and i can close this thread

Check the same file again.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@vjnvinod no single clue what you mean? This is best practice the way table is transformed. not sure what issue your are finding and what cannot be done. Anyhow, you have everything what you need.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

vjnvinod
Impactful Individual
Impactful Individual

@parry2k 

 

agree, its a best practice

the only issue client had is when he extracts the matrix table visual into excel, it looses the original table, basically all the details comes as coloumns in excel

as you have transform the data in the power query

 

the other issue due to my lack of experience in power BI, what i am facing is, when i replicate your model, all my planned, actuals, variance and variance% are coming as coloumn in the matrix, see below screenshot

not sure what i am doing incorrectly, but it comes perfectly when i drag and drop your file

 

Capture.PNG

 

 

Since I need to transform the data, can you share csv file as well and I will get back to you with your Pbix with full solution.


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

vjnvinod
Impactful Individual
Impactful Individual

@parry2k 

 

Can you see if you can acess the below link?

 

Pbix 

@vjnvinod yes links works,  I have pbix but I also need csv file. send that too.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

vjnvinod
Impactful Individual
Impactful Individual

@parry2k 

 

its the same structure and format, what you see in pbix, so nothing changing in the csv file

 

you can click on the elipisi in the visual and download that and help with the transformation

 

let  me know if you still need it

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.

Top Solution Authors