Forum Discussion

AteeqSundhu's avatar
AteeqSundhu
Frequent Visitor
2 years ago
Solved

Extract Maximum number against same row from data in multiple columns

I have a dataset wherein i want to calculate maximum amount from multiple columns against a single day/product/etc. Result in last column below;

ProductIDSalaryIncomeOther IncomeGross ProfitPresent Salary

RESULT

(MAX Value Needed)

ABCD1000

1800

0750021007500
DEFG200

7500

NUL

11009557500
HIJK600012000 85032512000
KLKM50097005000975088509750
  • pls try this

    the first option is if you have measures in your columns

     

    RESULT= 	
    MAXX (
    { [Salary],[Income],[Other Income],[Gross Profit],[Present Salary]},[Value])
    ------
    	
    RESULT= 
    VAR _t1 = CALCULATE(SUM('yourtable'[Salary]))
    VAR _t2 = CALCULATE(SUM('yourtable'[Income]))
    VAR _t3 = CALCULATE(SUM('yourtable'[Other Income]))
    VAR _t4 = CALCULATE(SUM('yourtable'[Gross Profit]))
    VAR _t5 = CALCULATE(SUM('yourtable'[Present Salary]))
    RETURN
    MAXX (
    { _t1,_t2,_t3,_t4,_t5},[Value])

     

3 Replies

  • pls try this

    the first option is if you have measures in your columns

     

    RESULT= 	
    MAXX (
    { [Salary],[Income],[Other Income],[Gross Profit],[Present Salary]},[Value])
    ------
    	
    RESULT= 
    VAR _t1 = CALCULATE(SUM('yourtable'[Salary]))
    VAR _t2 = CALCULATE(SUM('yourtable'[Income]))
    VAR _t3 = CALCULATE(SUM('yourtable'[Other Income]))
    VAR _t4 = CALCULATE(SUM('yourtable'[Gross Profit]))
    VAR _t5 = CALCULATE(SUM('yourtable'[Present Salary]))
    RETURN
    MAXX (
    { _t1,_t2,_t3,_t4,_t5},[Value])

     

    • AteeqSundhu's avatar
      AteeqSundhu
      Frequent Visitor

      Ahmedx Thanks for the reply it worked very well, however if I use same formula to extract MAX out of some other numeric data columns then it shows below message

      "A circular dependency was detected: DC061123[DR_LIMIT], DC061123[Inflow], DC061123[DR_LIMIT]."

      Formula Used

      RESULT1=
      VAR _t1 = CALCULATE(SUM('yourtable'[DR_Turnover]))
      VAR _t2 = CALCULATE(SUM('yourtable'[DR_Tunover1]))

      RETURN
      MAXX (
      { _t1,_t2},[Value])

       

      kindly guide

      • Ahmedx's avatar
        Ahmedx
        Icon for Super User rankSuper User

        pls share the file so we can help you