Forum Discussion

izzysoon's avatar
izzysoon
Helper I
4 months ago
Solved

Dynamic Ratio creator

Hello all, 

I am new to community.  Please kindly help!  I would like to select the "Field" in slicer and create a ratio.   Not sure I need to duplicate the "Field" to have two different slicers as well.  Thanks.

Data source

 

 

  • izzysoon's avatar
    izzysoon
    4 months ago

    Is this ok ?  

     

    DateFieldvalue
    Jan-23A45
    Jan-23B46
    Jan-23C47
    Jan-23D140
    Jan-23E10
    Feb-23A49
    Feb-23B11
    Feb-23C23
    Feb-23D41
    Feb-23E39
    Mar-23A40
    Mar-23B55
    Mar-23C39
    Mar-23D45
    Mar-23E105

     

    Example 2   
    from SlicerJan-23Feb-23Mar-23
    E1039105
    A454940
    Ratio (E/A)0.22220.79592.6250

     

    from SlicerJan-23Feb-23Mar-23
    A454940
    C472339
    Ratio (A/C)0.95742.13041.0256
  • For your reference.

     

    Step 0: I use these DATA below.

     

    Step 1: I make two tables and four measures below.

     <Tables>

        Field01 = SUMMARIZE('DATA','DATA'[Field])
        Field02 = SUMMARIZE('DATA','DATA'[Field])
     
    <Measures>
    Field01_Sel = SELECTEDVALUE(Field01[Field])
    Field02_Sel = SELECTEDVALUE(Field02[Field])
    value Sel = SUMX(FILTER('DATA','DATA'[Field]=[Field01_Sel]),'DATA'[value])+SUMX(FILTER('DATA','DATA'[Field]=[Field02_Sel]),'DATA'[value])
    Ratio = DIVIDE(SUMX(FILTER('DATA','DATA'[Field]=[Field01_Sel]),'DATA'[value]),SUMX(FILTER('DATA','DATA'[Field]=[Field02_Sel]),'DATA'[value]))
     
    Step 2: I make two slicers and a matrix below.
    <Ratio=A/C>

     <Ratio=E/A>

     

  • I don't know how to move the Ratio under the value Sel.

    It is easy making a line chart.

     

6 Replies

  • For your reference.

     

    Step 0: I use these DATA below.

     

    Step 1: I make two tables and four measures below.

     <Tables>

        Field01 = SUMMARIZE('DATA','DATA'[Field])
        Field02 = SUMMARIZE('DATA','DATA'[Field])
     
    <Measures>
    Field01_Sel = SELECTEDVALUE(Field01[Field])
    Field02_Sel = SELECTEDVALUE(Field02[Field])
    value Sel = SUMX(FILTER('DATA','DATA'[Field]=[Field01_Sel]),'DATA'[value])+SUMX(FILTER('DATA','DATA'[Field]=[Field02_Sel]),'DATA'[value])
    Ratio = DIVIDE(SUMX(FILTER('DATA','DATA'[Field]=[Field01_Sel]),'DATA'[value]),SUMX(FILTER('DATA','DATA'[Field]=[Field02_Sel]),'DATA'[value]))
     
    Step 2: I make two slicers and a matrix below.
    <Ratio=A/C>

     <Ratio=E/A>

     

    • izzysoon's avatar
      izzysoon
      Helper I

      Thanks Mickey64.  

      Is it possible to move the Ratio under the value Sel ?  The subtotal/Total prefers not shown.  In addition, how to make the ratio create a line chart?  Many thanks for your help! 

       

      Date1/23/20262/23/20263/23/2026
      FieldVal SelVal SelVal Sel
      A454940
      E1039105
      Ratio0.2222220.7959182.625
      • mickey64's avatar
        mickey64
        Super User

        I don't know how to move the Ratio under the value Sel.

        It is easy making a line chart.

         

  • Please include, in a usable format, not an image, a small set of rows for each of the tables involved in your request and show the data model in a picture, so that we can import the tables in Power BI and reproduce the data model. The subset of rows you provide, even is just a subset of the original tables, must cover your issue or question completely. Alternatively, you can share your .pbix via some cloud service and paste the link here. Do not include sensitive information and do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided and make sure, in case you show a Power BI visual, to clarify the columns used in the grouping sections of the visual.

     

    Need help uploading data? click here

     

    Want faster answers? click here

    • izzysoon's avatar
      izzysoon
      Helper I

      Is this ok ?  

       

      DateFieldvalue
      Jan-23A45
      Jan-23B46
      Jan-23C47
      Jan-23D140
      Jan-23E10
      Feb-23A49
      Feb-23B11
      Feb-23C23
      Feb-23D41
      Feb-23E39
      Mar-23A40
      Mar-23B55
      Mar-23C39
      Mar-23D45
      Mar-23E105

       

      Example 2   
      from SlicerJan-23Feb-23Mar-23
      E1039105
      A454940
      Ratio (E/A)0.22220.79592.6250

       

      from SlicerJan-23Feb-23Mar-23
      A454940
      C472339
      Ratio (A/C)0.95742.13041.0256