Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

dax measure help

Hi,
so I need to create a dax measure which calculates the percentage of deal type for each category.
calculation is 
Total number of Hire Purchase + Finance lease / Total amount financed for each category.

 

Hire purchase and Finance lease are just the values in the deal type column.

Not sure exactly how to format it 

11 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Anonymous Easiest way would be to create your measure:

    Measure = Hire Purchase + Finance lease / Total amount

     

    Then right click the measure in the visual's Values field well and choose Show as and then Percent of grand total

  • Anonymous 

    could you pls provide some sample data and expected output?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Doc Type

      Amount financed

       

      HP

      343

       

      FL

      54

       

      HP

      3

       

      FL

      56

       

      OH

      57547

       

      HP

      67568

       

      FL

      568756

       

       

      I need to count all the Hire Purchase and all the Finance lease and then divide them by the total amount financed for those deals only.
      to give me a percentage of the deals which are that type of lease. 

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

        Anonymous 

        is this what you want?

        Measure 2 = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Doc Type]="HP" ||'Table'[Doc Type]="FL"))/COUNTROWS('Table')
  • PC2790's avatar
    PC2790
    Icon for Community Champion rankCommunity Champion

    Try this:

     

    Column = DIVIDE(MyTable[Amount financed],CALCULATE(SUM(MyTable[Amount financed]),ALLEXCEPT(MyTable,MyTable[Doc Type])))
     
    and in Column Tools -->Format section, mark the column as Percentage.
    The result will look something as below: