Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

DAX Query Correction

i m trying to get the text value from country table based on a condition and a maximium value in nobel prize data table.
Below is my dax query that need to be corrected .
waiting for your  response.
thank you.
 
 
Country By Max Nobel Prize In Literature =
CALCULATE(
Max('Country Table'[Country] ), 'Nobel Prize Winner Data'[category] = "Literature",
FILTER(
ALL('Nobel Prize Winner Data'),
 
'Nobel Prize Winner Data'[share] = MAX('Nobel Prize Winner Data'[share]
)
)
)

2 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 

    please try

    Country By Max Nobel Prize In Literature =
    VAR LiteratureTable =
        FILTER (
            ALLSELECTED ( 'Nobel Prize Winner Data' ),
            'Nobel Prize Winner Data'[category] = "Literature"
        )
    VAR MaxShare =
        MAXX ( LiteratureTable, 'Nobel Prize Winner Data'[share] )
    RETURN
        CALCULATE (
            MAX ( 'Country Table'[Country] ),
            'Nobel Prize Winner Data'[share] = MaxShare,
            CROSSFILTER ( 'Country Table'[Country Abbrevation], 'Nobel Prize Winner Data'[Country Abbrevation], BOTH )
        )
  • v-xiaotang's avatar
    v-xiaotang
    Community Support

    Hi Anonymous 

    I just want to confirm if you resolved this issue? If yes, you can accept the answer helpful as the solution or share you method and accept it as solution, thanks for your contribution to improve Power BI.

    If you need more help, please let me know.

     

    Best Regards,

    Community Support Team _Tang

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