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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

AVERAGE BY CATEGORY

@v-xjiin-msft  @Vera_33 @Zubair_Muhammad 

I need help with DAX to create a measure

 

I have a table with Vessel name and Tonnage Capacity

 

Vessel NameTonnage Capacity
Vessel ABC0
Vessel XYZ25202.11
Vessel YTJ29881.42
Vessel IUK31085.14
Vessel LMN27712.07

 

I want to create a measure called Tonnage Capacity of Vessel which will throw the corresponding Tonnage Capacity for every vessel when I want to create power pivots etc

 

I have tried using the following measures

 

Average Capacity per Vessel = CALCULATE ('Tonnage Data Table'[TONNAGE CAP], ALLEXCEPT ( 'Trips Data Table', 'Trips Data Table'[Vessel] ) ) - This measure is throwing the average of the entire column when I am using in Power pivot instead of giving me the tonnage capacity against each vessel
 
AVERAGE 2 = VAR _VesselName = MAX('Tonnage Data Table'[Vessel Name] ) RETURN
CALCULATE(
AVERAGE('Tonnage Data Table'[Tonnage Capacity]),
'Tonnage Data Table'[Vessel Name] = _VesselName,
REMOVEFILTERS('Tonnage Data Table')

) This measure returns 0 instead of the corresponding tonnage capacity
 
Average =
CALCULATE (
AVERAGE ( 'Tonnage Data Table'[Tonnage Capacity] ),
FILTER ( ALLSELECTED ( 'Tonnage Data Table' ), 'Tonnage Data Table'[Vessel Name] = MAX ( 'Tonnage Data Table'[Vessel Name] ) )
)
 
 
 
Please help
1 ACCEPTED SOLUTION

Hi @Anonymous 

 

It was solved, @Anonymous sent me files. It was an Excel connected to PBI dataset, using fact table column to retrieve data from dim table.

View solution in original post

10 REPLIES 10
Anonymous
Not applicable

Hi @Anonymous ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Best Regards,
Eyelyn Qin

Hi @Anonymous 

 

It was solved, @Anonymous sent me files. It was an Excel connected to PBI dataset, using fact table column to retrieve data from dim table.

Anonymous
Not applicable

Hi @Anonymous ,

 

Quick summarization:

Eyelyn9_1-1643076696771.png

Or create a measure:

 

average measure = CALCULATE(AVERAGE('Tonnage Data Table'[TONNAGE CAP]),ALLEXCEPT('Tonnage Data Table','Tonnage Data Table'[Tonnage Vessel Name]))

 

Eyelyn9_0-1643076654837.png

 


Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Vera_33
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

I am not very sure what you want to achieve...your table only has 2 columns, and you want to select a Vessel Name in a slicer? to return an avg on Capacity of the same table? I saw there is another table Trips Data Table, what is in there? what is the relationship between these two tables?

Vera_33_0-1642733154164.png

 

Anonymous
Not applicable

I need to create  a measure which will give me the tonnage capacity of every vessel when I drop the same in power pivot. However I am unable to create such measure. When I am using the measures I have created in Power Pivot, I get the average of the entite column instead of corresponding tonnage capacity against each vessel name on dropping the measure in values sectionWhen I am using the measures I have created in Power Pivot, I get the average of the entite column instead of corresponding tonnage capacity against each vessel name on dropping the measure in values section

Hi @Anonymous 

 

I can't get what is the relationship between your tables, and how your results came out like the screenshot. Can you provide a sample file? Will pm you my email address.

Anonymous
Not applicable

Hello @Vera_33 

 

I am using Power Pivot in excel for my final analysis

 

Yes, I have 2 set of excel workbooks, Trips data table(Contains columns like Tonnage , Revenue) and Tonnage data table Contains columns like Vessel name and Tonnage Capacity

 

I need to create  a measure which will give me the tonnage capacity of every vessel when I drop the same in power pivot. However I am unable to create such measure. 

Anonymous
Not applicable

HelloMeasure.JPG

StefanoGrimaldi
Resident Rockstar
Resident Rockstar

if its for a simple visual a simple average function with nothing more will work, when you put in a visual table the average value dax + the category or vessel name the in build filter of the visual will separate that average dax by the category you added, 

asl tyou can try something like this: 

dax name = 

var X = "put there the column name of the category column"

var y = calculate(average(value field), category field column = X)

return Y





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




Anonymous
Not applicable

I am unable to create the measure as you have directed. Please refer the screenshot below
Just want to give move background. I have a Tonnage Data Table with 2 columns 
Tonnage Capacity  - Tonnage Data Table'[Tonnage Capacity] and Tonnage Vessel Name  - Tonnage Data Table'[Tonnage Vessel Name]

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.