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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ewelinag17
Frequent Visitor

A measure that calculates the ratio of the number of packages to the production volume in a month

Dear
I have two tables. One contains the dates and sizes of the product packages.
The second includes production dates and volumes.
They are database-linked by` date.
I need a graph that shows the package capacity on the "x" axis and the calculated ratio of the number of packages to the production volume on the "y" axis.
An example date below:

ewelinag17_0-1598222514816.png


Do you know How to do it?
Thank you in advance for your help.
best regards

1 ACCEPTED SOLUTION

@ewelinag17 - You should be able to do something like this:

 

Measure =
  VAR __Count = COUNTROWS('Table1')
  VAR __Sum = SUMX(RELATEDTABLE('Table2'),[production volume])
RETURN
  DIVIDE(__Sum,__Count,0)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
ewelinag17
Frequent Visitor

@Anonymous @amitchandak @Greg_Deckler 

I'll simplify it a bit, because if I find out how to do this part, I can handle the rest.
I have two tables at the entrance.

ewelinag17_0-1598260504766.pngewelinag17_1-1598260529904.png

I connect them with each other in the database using the "data" column.
In the output, I want to get a graph that was created on the basis of the table below.

ewelinag17_2-1598260598788.png

There will be a year and month filter for the chart.

I can count the rows, but I use 4 measures and the graph doesn't come out. Can You help me?  Can it be done with one measure?

@ewelinag17 - You should be able to do something like this:

 

Measure =
  VAR __Count = COUNTROWS('Table1')
  VAR __Sum = SUMX(RELATEDTABLE('Table2'),[production volume])
RETURN
  DIVIDE(__Sum,__Count,0)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Is this model in imported mode, direct query or composite mode?

amitchandak
Super User
Super User

@ewelinag17 , I do not see any relation between package and production volume or date and date.

 

The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format?
Appreciate your Kudos.

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
Greg_Deckler
Community Champion
Community Champion

@ewelinag17 - What do you mean by "package capacity" ? Can you post the data as text and the expected output from your sample data? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.