Forum Discussion

sccoleman1189's avatar
7 years ago
Solved

Calculating percentage based on information from multiple tables

Hello,

 

I am trying to calculate the percentage of specific groups (buckets) based on the number of orders. Buckets and orders are from 2 different tables.

 

Buckets contains multiple groups that is a column in my category table. 

Orders is a measure that I created counting the distinct number of ids from my prod table.

 

Instead of creating a measure for each bucket, I wanted to know if there is a way to just create a DAX in that could divide the number of orders based on each category.

 

Below, I was able to just grab my bucket column (value field) and date (rows) and created a matrix. I would like to see the year populated with the percentage numbers. 

 

I hope I have clearly explained what I am looking for. Also the two tables have a relationship based on different columns.

  • v-jiascu-msft's avatar
    v-jiascu-msft
    7 years ago

    Hi sccoleman1189,

     

    Where are the Years from? Maybe you can try the formula below and refer to the snapshot.

    Measure = count('OrderTable'[Order ID-Prod])

    Calculating-percentage-based-on-information-from-multiple-tables

     

     

    Best Regards,

5 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi sccoleman1189,

     

    Please share a sample that we can copy with or download. Please mask the sensitive parts first. The percentage relates to two parts, numerator and denominator. What are they?

     

    Best Regards,

    • sccoleman1189's avatar
      sccoleman1189
      Icon for Helper I rankHelper I

      Below is an example of the data. 

       

      Order ID and Job Code are in the same table, Bucket is in another table. The tables are joined via job code.

       

      I want to calculate the percentage of orders based on each bucket.

       

      Order ID-ProdBucket-CategoryJob Code-Prod
      AInstallxyz
      BRepairqrs
      CInstallxyz
      DCommercialfgh
      ECommercialdef
      FInstalllmn
      GCommercialabc
      HRepairtuv
      • v-jiascu-msft's avatar
        v-jiascu-msft
        Icon for Microsoft Employee rankMicrosoft Employee

        Hi sccoleman1189,

         

        Where are the Years from? Maybe you can try the formula below and refer to the snapshot.

        Measure = count('OrderTable'[Order ID-Prod])

        Calculating-percentage-based-on-information-from-multiple-tables

         

         

        Best Regards,