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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Benc7777
Helper I
Helper I

Calculating a % between two numbers in two queries

I hope someone can help.

 

I have tried quick measure and it crashes everytime.

 

So I have two queries runniing from SQL, linked a relationship between "Customer Name" single slicer searches both, lovely.

 

All I want is a seperate box in the percentage of Sum of items / Sum of Remakes - I honestly cannot figure out how. What am I dong wrong its driving me crazy. I have never used DAX so i cant understand it.

 

Benc7777_0-1714485464088.png

 

Please can anyone help ??

 

1 ACCEPTED SOLUTION

I don''t recommend joining your fact tables to each other (i.e. joining Query1 to Query2), a star schema should be used. I would also still recommend creating the individual explicit measures, but if you don't do that you could do Percentage = DIVIDE(SUM('Query1'[Items]),SUM('Query2'[Remakes]))

 

DIVIDE function (DAX) - DAX | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

5 REPLIES 5
Benc7777
Helper I
Helper I

@audreygerredYou have saved me some grey hairs, I will read through your posts tonight.

 

A great thank you for taking the time to help , really appriciated !

Happy to help! Good luck on your Power BI journey!!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





audreygerred
Super User
Super User

Hello! You will have to create a star schema model (i.e. fact and dimension). I have a link to a blog I wrote about it here: http://powerbiwithme.com/2023/07/30/the-star-schema-edition/

 

For your model, you should have a customer dim table and a date dim table. Once you have those, join them to each of your two fact tables (query 1 and query 2).

 

I also like to have a measures table. To create one, click Enter Data in Power BI and name the table Key Measures (or whatever you want). Once the new table is there, create a measure for Items; Items = SUM('Query1'[Items]). Next, create a measure for Remakes; Remakes = SUM('Query2'[Remakes]). Next, create your percentage measure; Percentage = DIVIDE(Items,Remakes). Then, format as percentage.

 

Any visuals you make that need to use customer name - grab the field from the customer dim table instead of query1 or query2 (in fact, I would hide customer in both of those tables). Ditto on date lements - these will now come from the date table and you can hide the date fields in query1 and query2. Here is a link to a blog I wrote about date tables and it has a link to the reference date table I love from SQLBI: http://powerbiwithme.com/2023/08/01/the-custom-date-table-edition/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Ill try and understand that .

 

Can i not do a measure

 

Percentage = DIVIDE('Query1' Items - Query2 Remake Items ?
 
How would i write that ?

I don''t recommend joining your fact tables to each other (i.e. joining Query1 to Query2), a star schema should be used. I would also still recommend creating the individual explicit measures, but if you don't do that you could do Percentage = DIVIDE(SUM('Query1'[Items]),SUM('Query2'[Remakes]))

 

DIVIDE function (DAX) - DAX | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.