Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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 😞

 

 

 

  • Icey's avatar
    Icey
    5 years ago

    Hi Anonymous ,

     

    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.

7 Replies

  • Hi Anonymous ,

     

    You can create a column using the following DAX expression:

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

     

    Thanks,

    Pragati

    • Anonymous's avatar
      Anonymous
      Not applicable

      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.

      • Pragati11's avatar
        Pragati11
        Super User

        Hi Anonymous ,

         

        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