Forum Discussion

wheelsshark's avatar
wheelsshark
Frequent Visitor
3 years ago
Solved

DAX function

Hi  I have a datatable like   in Power BI I have a dax function to find Max of each Town(T1, T2, T3) - it gives (201,200,200). Depending on the slicer selection it shows this value ...
  • wdx223_Daniel's avatar
    3 years ago

    if the lookup value is duplicated, lookupvalue will get a error.

    LookupTown=VAR _h=[HighestTotal] RETURN CONCATENATEX(FILTER('tempdumpdata','tempdumpdata'[Total]=_h),'tempdumpdata'[Town],",")

  • Anonymous's avatar
    Anonymous
    3 years ago

    HI wheelsshark,

    Perhaps you can add a new condition to compare with the name field and selection to filter the result.

    LookupTown =
    VAR _h = [HighestTotal]
    VAR selection =
        VALUES ( Table[Name] )
    RETURN
        CONCATENATEX (
            FILTER ( 'tempdumpdata', 'tempdumpdata'[Total] = _h && [Name] IN selection ),
            'tempdumpdata'[Town],
            ","
        )

    Regards,

    Xiaoxin Sheng