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
koray
Helper V
Helper V

How can I get use filtered value using IF

Hello,

 

In my table, I need information about the amount of products linked to the relevant orders. 

I want to divide the GRM quantities by the number 1000 for the calculation in my table to work correctly. 

How can I do this using IF in a new column.

 

 

If what I want is the "IssuedQuantitiy" column and the "UOMCode" value is GRAM, then the "IssuedQuantitiy" / 1000 will appear in the new column. If "UOMCode" is ST and KGM, then "IssuedQuantitiy" value should be the same.

 

Sorry for my bad English 😞

 

koray_0-1599214691311.png

 

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @koray ,

 

Please check if the expressions below are what you want:

Column =
IF (
    [UOMCode] = "GRM",
    [IssuedQuantitiy] / 1000,
    IF ( [UOMCode] IN { "ST", "KGM" }, [IssuedQuantitiy] )
)
Column =
IF (
    [UOMCode] IN { "GRM", "ST", "KGM" },
    [IssuedQuantitiy] / 1000,
    [IssuedQuantitiy]
)

 

 

 

Best Regards,

Icey

 

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

View solution in original post

7 REPLIES 7
Pragati11
Super User
Super User

Hi @koray ,

 

You can create a column using the following DAX expression:

CalcCol = IF(UOMCode = "GRAM", DIVIDE(IssuedQuantitiy, 1000, 0), IssuedQuantitiy)

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Unfortunately it didn't work 😞  And I want to get all of KG, GRM and ST quantity values. I just want it to be GRM ones / 1000.

@koray , a formula like this should have worked as new column

 

if([UOMCode] ="GRAM", [IssuedQuantitiy]/1000.0,[IssuedQuantitiy])

 

if([UOMCode] ="GRM", [IssuedQuantitiy]/1000.0,[IssuedQuantitiy])

 

Can you share sample data and sample output in table format?

Hello @amitchandak @Pragati11 

 

Also I want to add KG and ST quantities to the new column too. How should the whole coding be?

Icey
Community Support
Community Support

Hi @koray ,

 

Please check if the expressions below are what you want:

Column =
IF (
    [UOMCode] = "GRM",
    [IssuedQuantitiy] / 1000,
    IF ( [UOMCode] IN { "ST", "KGM" }, [IssuedQuantitiy] )
)
Column =
IF (
    [UOMCode] IN { "GRM", "ST", "KGM" },
    [IssuedQuantitiy] / 1000,
    [IssuedQuantitiy]
)

 

 

 

Best Regards,

Icey

 

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

Hi @koray ,

 

Your requirement is getting confusing now.

 

You wanted a column with values against your categories - KG, GRAM, etc.

 

Please share more details. Create a sample data and from that share what output is expected. You are not clear on what you want.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi @koray ,

 

Can you share the column dax expression that you created?

Because the dax expression I sugested should work.

Also what are data-types of your column? IssuedAmount should be numeric, other column should be Text.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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.