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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Variance Column based on a row with conditions

Hi, 

 

I am wanting to create a calculated column "Variance from Store ()" using DAX. The column will show the variance price for one row based on all the other stores in the table. 

 

For example:

 

Filterd Store: A

StorePriceVariance from Store A
B$30$15
C$45$30
A$15$0
D$20$5



10 REPLIES 10
amitchandak
Super User
Super User

Try like

Variance from Store A = [Price] - Maxx(filter('Table', 'Table'[Store] ="A"),[Price])

 

Or

Variance from Store A = [Price] - Maxx(filter(all('Table'), 'Table'[Store] ="A"),[Price])

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
parry2k
Super User
Super User

@Anonymous  always it will be compared against STORE A, solution depends on this answer.



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.

Anonymous
Not applicable

--

@Anonymous I knew it and that's why I asked.

 

You need to create a separate table for the slicer, with just one column, called Store, and put this on the slicer and now from here, it is super easy.

 

You can tweak it as per your model.

 

Compare = 
VAR __selectedStore = SELECTEDVALUE ( Slicer[Store] )
VAR __selectedStoreValue = CALCULATE  ( MAX ( Table[Price] ), Table[Store] = __selectedStore )
RETURN
MAX ( Table[Price] ) - __selectedStoreValue

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

 



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.

Anonymous
Not applicable

@parry2k The requirements are for a static store "A"

 

The above response from the community member does not work. Do you have an alternate solution?

@Anonymous hang tight going to send you the solution with dynamic and fixed store. 



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.

@Anonymous solution attached, both dynamic and fixed, in dynamic, there is treat for you, it highlights the selected store 🙂

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

 

 



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.

Anonymous
Not applicable

@parry2k 

 

I was using the Variance from Store A (Fixed) solution, but it gives the same number for Price, and doesn't subtract from store "A". 

Do you know why it does this?

 
 

@Anonymous not sure what you mean? Can you elaborate bit more with the example?



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.

Anonymous
Not applicable

@parry2k 

 

I am using this measure to determine variance:

 

$ Sale Variance from Store A =
VAR __Store= "A"
VAR __SaleEach = CALCULATE(SUM('Table'[SumSale]), 'Table'[Store] = __Store)
RETURN
(SUM('Table[SumSale])- __SaleEach )
 
But I am still getting this result; the selected store shows $0 as expected, but the others are not subtracting from the selected store as thy should. exampls: $520.49 - $73.91
 
help.PNG

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.