Forum Discussion

RP_OFaustino's avatar
RP_OFaustino
Helper I
19 days ago
Solved

Total Count in Column

Hello MVPS,


I  thought that this was an easy scenario but I have burned 2 days without any success. 

 

Your Help will be greatly appreciated.


I have 2 questions. Here is the image of my table, not a matrix:

1st Question: instead of 1 in "_M_Campaign_TotalCount", how can I make it to display 30 per row? I need to count how many times the "_fact_CampaignDetails_Pipeline.Campaign_Name__c" existed in my whole table:

2nd question: I have a 5th Column named "Earliest Responded Date". what function should i use to get the earliest responded date from the 4th Column "_fact_CampaignDetails_Pipeline.Responded_Date__c"

Again, any help would be appreciated!

 

  • ryan_mayu's avatar
    ryan_mayu
    10 days ago

    RP_OFaustino 

    pls see if this is helpfule.

     

    Measure = CALCULATE(COUNT('Table'[Product Name]),ALLEXCEPT('Table','Table'[Account],'Table'[Campaign Attended],'Table'[Contact]))
     
    pls see the attachment below. if this does not work, pls update the sample data
     

10 Replies

  • Hello RP_OFaustino,
    If you're trying to show how many times each Campaign_Name__c appears in the table, CALCULATE() together with ALLEXCEPT() should do it. That keeps the campaign as your filter while dropping the other columns, so every row for the same campaign ends up showing the same count.
    For the earliest responded date, MIN() is the function I will use, wrapped in CALCULATE() with the same ALLEXCEPT() grouping. Again, the grouping matters. If you want the earliest date for each campaign, use the same grouping as the count.
    Can you confirm whether _M_Campaign_TotalCount is a measure or a calculated column? If you can also post the DAX you're using now, it'll be easier to suggest the smallest change.

  • Hello RP_OFaustino ,
    I would like to let you know that this depends on whether you want the calculation to respect filters/slicers or always return the total for the entire dataset. In most Power BI reports, measures are the preferred approach.

    For 1st Que Answer: Use below measure to get Campagin Name count

    Campaign Total Count =
    CALCULATE(
        COUNT('TableName'[Campaign_Name__c]),
        ALLEXCEPT(
            'TableName',
            'TableName'[Campaign_Name__c]
        )
    )

    For 2nd Que Answer: Use below measure to get Earliest Responded Date

    Earliest Responded Date =
    CALCULATE(
        MIN('TableName'[Responded_Date__c]),
        ALLEXCEPT(
            'TableName',
            'TableName'[Campaign_Name__c]
        )
    )

     

    Thanks,
    If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

  • Hi,

    Does this measure work

    Measure = countrows(allselected(Data[c_opp_name]))

    If it does not, then please share the download link of the PowerBI file.

  • not clear about this request. could you pls provide some sample data and expected output?

  • Hello ryan_mayu Ashish_Mathur ajaybabuinturi Olufemi7 !

    My apologies for not being able to respond immediately and for not providing a detailed explanation of the problem.

    Here are the details:


    I applied your suggested solutions in creating the dax measures but it is displaying a much larger number.

    What I did was, I referenced the transaction table in power query, then group them by concatenated Opporunity ID and Campaign name then count Rows.


     


    Then created a relationship between the transaction table and new grouped transaction table. Making it like a reference. Then used Related Function to get the number.

    It's very excel like on the approach, but it does get the me the correct number.

    Again, thank you for all your help!

    • v-saisrao-msft's avatar
      v-saisrao-msft
      Community Support

      Hi RP_OFaustino,

      Glad to hear you got the correct result, and thanks for taking the time to share what worked for you—it'll be helpful for others too.

       

      Thank you.

       

      • RP_OFaustino's avatar
        RP_OFaustino
        Helper I

        Thank you v-saisrao-msft ! the experts that helped and will help me in the future are truly amazing! Will drill down on their suggestions more and apply it in my project as well.

  • Hello ryan_mayu Ashish_Mathur ajaybabuinturi Olufemi7 !

    My apologies for not being able to respond immediately and for not providing a detailed explanation of the problem.

    Here are the details:


    I applied your suggested solutions in creating the dax measures but it is displaying a much larger number.

    What I did was, I referenced the transaction table in power query, then group them by concatenated Opporunity ID and Campaign name then count Rows.


     


    Then created a relationship between the transaction table and new grouped transaction table. Making it like a reference. Then used Related Function to get the number.

    It's very excel like on the approach, but it does get the me the correct number.

    Again, thank you for all your help!

    • Ashish_Mathur's avatar
      Ashish_Mathur
      Super User

      Hi,

      Please share the download link of the PBI file.  Show the problem and expeced result there clearly.

    • ryan_mayu's avatar
      ryan_mayu
      Super User

      RP_OFaustino 

      pls see if this is helpfule.

       

      Measure = CALCULATE(COUNT('Table'[Product Name]),ALLEXCEPT('Table','Table'[Account],'Table'[Campaign Attended],'Table'[Contact]))
       
      pls see the attachment below. if this does not work, pls update the sample data