Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Non blank value in column

Hi Team,

I have base table as below 

CodeRegionSales
123 10
123ABC20
456 30
456DEF40

 

I have created a Distinct value from code as below

Code
123
456

 

I need to create allokup region column from the base as below.

If the value if blank in region it should look for next value.

CodeRegion
123ABC
456DEF

 

Thanks in advance !

  • Try this:

    Region Table =
    DISTINCT(
        SELECTCOLUMNS(
            FILTER('Table','Table'[Region]<>BLANK())
            ,"Code", 'Table'[Code]
            ,"Region", 'Table'[Region]
        ))

     



8 Replies

  • Try this:

    Region Table =
    DISTINCT(
        SELECTCOLUMNS(
            FILTER('Table','Table'[Region]<>BLANK())
            ,"Code", 'Table'[Code]
            ,"Region", 'Table'[Region]
        ))

     



  • jaweher899's avatar
    jaweher899
    Icon for Impactful Individual rankImpactful Individual

    To create the "Allokup Region" column, you can use the DAX formula "CALCULATE" with "IF" and "MIN" functions. Here's the formula:

    Allokup Region = CALCULATE(MIN(Base[Region]), FILTER(Base, Base[Code]=DistinctCodes[Code] && NOT(ISBLANK(Base[Region]))))

    Assuming your base table is named "Base" and your distinct code table is named "DistinctCodes", you can use this formula in a new calculated column. The formula finds the minimum non-blank value of the "Region" column for each code.

    • Anonymous's avatar
      Anonymous
      Not applicable

      jaweher899 ,

      This code is not working as expected plz find below images. 131 code should have value but in lookup table I still see blank.

       

       

  • hi Anonymous 

    try to create a calculated table like this:

    Table =
    SUMMARIZE(
        BaseTable,
        BaseTable[Code],
        BaseTable[Region]
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      FreemanZ ,

      Thanks for your rply !

      This is not working as expected attaching the image.

       

      Thanks !