Forum Discussion

Imran_1112's avatar
Imran_1112
New Member
2 years ago
Solved

Single column formula for 2 options Complete and pending

Dear All,

 

Need help as i am new to Power BI.

 

To calculate % for in single column with text of (Complete and Pending) by using slicer, click on pending on slicer will give % for pending, when click on complete will give % for complete.

 

Thanks in advance

  • Imran_1112 ,

    I believe the below measure logic will work for you and it's a dynamic logic 🙂

    Measure Logic = 
    VAR __AllCount =
        CALCULATE ( COUNT ( Data[RFS] ), REMOVEFILTERS ( Data[RFS] ) )
    VAR __Count =
        COUNT ( Data[RFS] )
    RETURN
        DIVIDE ( __Count, __AllCount )




     

     

    If I resolve your issue please accept it as solution.
    Thanks

     

7 Replies

  • databi_nerd's avatar
    databi_nerd
    Frequent Visitor

    Hi Imran_1112 ,

    Can you please share some sample data or if possible the .pdix file with required logic?

  • Hi, Thanks for your reply,

    Below is the text sample of few in that column containing 87 Rows in real, screenshot in below has the slicer for pending, complete and gauge. My aim is when i click on complete values will show on gauge as well as will show the percentage for completed, in other way when i select pending on slicer, it will reflect value on gauge and shows pending percentage.

     

    Please help if its possible. Thanks again.

     

     

    RFS
    Completed
    Completed
    Completed
    Completed
    Completed
    Completed
    Pending
    Completed
    Pending
    Pending
    Pending
    Pending
    Pending
    Pending
    Pending
    Pending
    Pending
    Pending

     

     

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Imran_1112 ,

    Below is my table:

    The following DAX might work for you:

    Measure = 
       COUNT('Table'[RFS])/18

    The final output is shown in the following figure:

    Best Regards,

    Xianda Tang

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

     

     

    • Imran_1112's avatar
      Imran_1112
      New Member

      Dear Xianda Tang,

       

      Thanks for your reply, Its working well but i need to update total count every time when there is new site added. In your formula /18 has to be change every time when i upload new row or the row count increase.

      Is there any way where it counts automatically the total rows (in this case 18) instead of putting manual.

       

      Thanks again

      COUNT('Table'[RFS])/18

       

      • databi_nerd's avatar
        databi_nerd
        Frequent Visitor

        Imran_1112 ,

        I believe the below measure logic will work for you and it's a dynamic logic 🙂

        Measure Logic = 
        VAR __AllCount =
            CALCULATE ( COUNT ( Data[RFS] ), REMOVEFILTERS ( Data[RFS] ) )
        VAR __Count =
            COUNT ( Data[RFS] )
        RETURN
            DIVIDE ( __Count, __AllCount )




         

         

        If I resolve your issue please accept it as solution.
        Thanks