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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

When adding Hands on column to your table visual right click and you will see many operations such as SUM, Average etc etc. Use average. If it does'nt work please explain a bit more so that I can fully understand what you are doing.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

Anonymous
Not applicable

the on hand column is adding all the rows that is why it's showing 1280, is there a way to show 32  for the on hand sum column?

Anonymous
Not applicable

Harsh333_0-1634030703453.png

 

 Can you access this for the On_hand Column ??? there select Average from this dropdown.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

 

Anonymous
Not applicable

hi @Anonymous 

Can i use it for another calculated field?

 

like  how do i do,

ON_HAND - REQUIRED.QUANTITY 

should be 32 - 40 , desired outout = -8

 

 

if on_hand correct value is just from the dropdown but not came from the calculated column

Anonymous
Not applicable

You can create a calculated column as shown below

Harsh333_0-1634031610974.png

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

Anonymous
Not applicable

@Anonymous 

the data looks like this actually,

 

Laedays_0-1634032648252.png

 

my goal is to get the output below:

REQUIRED QUANTITY = ADDING ALL THE ROWS

ON_HAND = calculated field that will only get the minimum/average

shortage = ON_HAND - REQUIRED QUANTITY (TOTAL OF 40)

Laedays_1-1634032798357.png

 

Anonymous
Not applicable

You'll show the final output in table visual?

you can change the calculated column to this 

Desired Output = SUM(Sheet1[Required])-Sheet1[On Hand]
Anonymous
Not applicable

@Anonymous still not working. you might want to check the sample file i created.

 

https://www.dropbox.com/s/bo84cwqa7lpmcha/samplepbi.pbix?dl=0

 

selimovd
Super User
Super User

Hey @Anonymous ,

 

yes, you can exclude that item from the calculation.

Try the following approach:

Average without 12P9813X032 =
CALCULATE(
    AVERAGE( myTable[ValueColumn] ),
    myTable[COMPONENT_CODE] <> '12P9813X032'
)

 

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

hi @selimovd it's showing blank as an output using the calculation you gave

Sorry, then I didn't get what you want to do. What exactly do you want to archive?

Anonymous
Not applicable

@selimovd 

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 1241 because it's adding all the rows. 

 

Laedays_1-1634030616731.png

 

Hey @Anonymous ,

 

and what is the formula of the measure [On Hand Average]?

The following should give you the average of 32:

On Hand Average = AVERAGE( myTable[ValueColumn] )

 

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

Hey @Anonymous ,

 

that's the formula for the measure:

On Hand Average = AVERAGE( Data[ONHAND_QTY] )

 

And then it will return the average:

selimovd_0-1634049886403.png

 

The file you gave me had 35 as value for Component_Code 12P9813X032 and not 32 as shown in your first screenshot.

 

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

hello @selimovd why is it different with when the pbix is connecting to actual data source which is from dataflow.

 

Laedays_0-1634050885519.png

 

@Anonymous  When the result is different, then the underlying data will be different. Take a look at the table and analyze it. You can also share the file with me, then I can take a look.

Anonymous
Not applicable

hi @selimovd how do i share file with confidential data? I really want to but there is so much confidentality. and it's connecting to dataflow. how is that possible for sharing?

Hey @Anonymous ,

 

no if there is confidential data you can't share. You can import the data from dataflow, then you could share the file.

In this case take a look at the data table and check the values in the column. The average for Component_Code 12P9813X032 will be 112'429.53, so there should be some big values.

 

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 i was able to hide some of the confidential columns. you may now check the sample pbix, to help me fix the solution.

 

https://www.dropbox.com/s/bo84cwqa7lpmcha/samplepbi.pbix?dl=0

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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