Forum Discussion

EbyEaso's avatar
EbyEaso
Helper III
2 years ago
Solved

Ratio Calculation

Hello, I need some assistance here. I have below sample data. I need to find out the ratio between two status of the issue.

 

Needed output is ration between the types of issue (but only between Parts and Hardware). In this case it is 1:2

 

Somebody can please assist me? So that I can get ration for each site.

 

Sl NoLocationType Of IssueDate ReportedStatus
1Site 1Hardware10-Jan-24Resolved
2Site 2Software10-Jan-24In Progress
3Site 3Software10-Jan-24Resolved
4Site 2Parts15-Jan-24Awaiting
5Site 2Hardware15-Jan-24Resolved
6Site 3Parts31-Jan-24Resolved
7Site 7Hardware2-Feb-24Resolved
8Site 8Hardware2-Feb-24Awaiting
9Site 7Software20-Feb-24In Progress
10Site 10Software20-Feb-24Resolved
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi EbyEaso ,

    Based on your problems, here are my answers.

    First I created a table based on your description.

    Then created four Measure.

    Total Hardware Issues = SUMX(FILTER('Table', 'Table'[Type Of Issue] = "Hardware"), 1)
    Total Parts Issues = SUMX(FILTER('Table', 'Table'[Type Of Issue] = "Parts"), 1)
    Issue Ratio = DIVIDE([Total Hardware Issues], [Total Parts Issues])
    Ratio Display = (CONCATENATE("1:", [Issue Ratio]))

    Finally you will see the result you want.

     

     

    Best Regards

    Yilong Zhou

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

6 Replies

  • Hi,

    I am not sure about how your semantic mode looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

     

     

     

    KEEPFILTERS function (DAX) - DAX | Microsoft Learn

     

    Issue count % only hardware + parts: =
    VAR _countall =
        COUNTROWS (
            CALCULATETABLE (
                Data,
                'Type Of Issue'[Type Of Issue] IN { "Hardware", "Parts" }
            )
        )
    VAR _count =
        COUNTROWS (
            CALCULATETABLE (
                Data,
                KEEPFILTERS ( 'Type Of Issue'[Type Of Issue] IN { "Hardware", "Parts" } )
            )
        )
    RETURN
        DIVIDE ( _count, _countall )
    

     

  • Thank You ThxAlot  and Jihwan_Kim 

    Bu am looking in a ration form. Example as below.

     

     

    Thank You ThxAlot  Jihwan_Kim 

    But am looking in a ration form.

     

    Example as below.

     

    SiteHardwarePartsRatio
    Site 11 1:0
    Site 2211:1
    Site 35151:3
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi EbyEaso ,

      Based on your problems, here are my answers.

      First I created a table based on your description.

      Then created four Measure.

      Total Hardware Issues = SUMX(FILTER('Table', 'Table'[Type Of Issue] = "Hardware"), 1)
      Total Parts Issues = SUMX(FILTER('Table', 'Table'[Type Of Issue] = "Parts"), 1)
      Issue Ratio = DIVIDE([Total Hardware Issues], [Total Parts Issues])
      Ratio Display = (CONCATENATE("1:", [Issue Ratio]))

      Finally you will see the result you want.

       

       

      Best Regards

      Yilong Zhou

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

      • EbyEaso's avatar
        EbyEaso
        Helper III

        Anonymous  Thank you for the response and udpate. Apreciate it. It works. Cool.

         

        I havew one more thing. What if we have more decimal values in the outout. I tried to chnage the decimal value to zero, but it wont change in the result.