Forum Discussion

Omnia24's avatar
Omnia24
New Member
3 years ago

Dynamic Values in text box using DAX functions

Hello, I want to create a text box with a dynamic values, something like smart narrative but customized.  I have Business Name, Weight, and Year columns, I'm new to DAX functions, and I want some help in the following:

  • I want to show values of business name with max sum of weight.
  • business name with second highest sum of weight.
  • business name with third highest sum of weight.
  • business name with the highest total of sum of weight.
  • sum of weight for business name with the highest total of sum of weight as % of total.

your assitance is highly appreciated.

1 Reply

  • Udbz's avatar
    Udbz
    Regular Visitor

    Your best bet is to use smart narrative. Simple string concats also work. 
    For eg. create a measure for all the stuff u looking for

     

    business name: SELECTEDVALUE( Table[businessname])

     

    WEIGHTS sum: SUM( Table[WEIGHTS])

     

    For the second third and forth highest weight u shud define what ur basis of such classification and then. This measure:


    var mytable=SUMMARIZE( table, [basiscolumn1], [basiscolumn2],.... and more u want)

     

    var mytable2=ADDCOLUMNS(mytable,"sum of weights", calculate(sum( weights)))

     

    var mytable3=ADDCOLUMNS(mytable2, "rank", rankx(mytable2,,[sum of weights])

     

    var mysumx=sumx(filter(mytable3,[rank]=3)),[sum of weights])

    Return

    mysumx