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
Anonymous
Not applicable

LOD? DAX?

Is there a way to get the value of On Hand to be 32 using a calculated field??  My goal is to get the correct value which is 32 without using Average for the component 12P9813X032. But the value is showing 1280 because it's adding all the rows as showing in the table below. 

 

Is there a way to get 32 using calculated field?

Laedays_2-1634027097416.png

Laedays_3-1634027545620.png

 

 

1 ACCEPTED SOLUTION

Hey @Anonymous ,

 

I think I found the reason. You added the formula as calculated column, but you have to add it as measure:

selimovd_0-1634056721195.png

 

Then the result is correct:

selimovd_1-1634056758763.png

 

To understand the difference, a calculated column is just a new column in the table. In your case you added a new column that returned for every row the average of

tableforqty[ONHAND_QTY] what is for each row the same value as the column tableforqty[ONHAND_QTY]. When you put that calculated column in the matrix the visual was summing up the averages, what was equal to the total.
 
If you use a measure it will always be calculated on the fly and in the context that you are using it. So if you put the measure in the matrix, it will calculate the average for each Component_Code and also for the total.
 
You can see the difference also by the logo. The calculated column [On Hand Average] has the icon of a table, the measure [On Hand Average as Measure] has the icon of a measure.
 

selimovd_2-1634056845499.png

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

View solution in original post

24 REPLIES 24

Hey @Anonymous ,

 

I think I found the reason. You added the formula as calculated column, but you have to add it as measure:

selimovd_0-1634056721195.png

 

Then the result is correct:

selimovd_1-1634056758763.png

 

To understand the difference, a calculated column is just a new column in the table. In your case you added a new column that returned for every row the average of

tableforqty[ONHAND_QTY] what is for each row the same value as the column tableforqty[ONHAND_QTY]. When you put that calculated column in the matrix the visual was summing up the averages, what was equal to the total.
 
If you use a measure it will always be calculated on the fly and in the context that you are using it. So if you put the measure in the matrix, it will calculate the average for each Component_Code and also for the total.
 
You can see the difference also by the logo. The calculated column [On Hand Average] has the icon of a table, the measure [On Hand Average as Measure] has the icon of a measure.
 

selimovd_2-1634056845499.png

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

Anonymous
Not applicable

@selimovd thank you so much for this wonderful information. i didnot know it until you mentioned it to me. thanks!

Tahreem24
Super User
Super User

@Anonymous  I don't quite well understand your scenario. But What I understood from your post is you want 32 as an output for on hand average.

On Hand Average  Measure = DIVIDE(SUM(TableName[RequiredQuantity]),SUM(TableName[On Hand Sum]))

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

@Tahreem24 

 

I have a column in the table "Global_Inventory.On_Hand"  

 

i need to have a calculated field that will show it in the view to be 32, but it's showing 1280 because it's adding all the rows. 

 

Laedays_1-1634030616731.png

 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.