Forum Discussion

jr3151006's avatar
jr3151006
Icon for Helper IV rankHelper IV
4 years ago
Solved

How to count (sum) records from different Tables?

Hi,

 

we have a situation with an Excel file which has 03 spreadsheets inside. When we open it via PBI, we select all of these 03. The

We need show on some page, the count of all records from spreadsheet A + all records from spreadsheet B + all records from spreadsheet C.

 

Let's say that the:

  • 'A' has 02 records;
  • 'B' has 04 records;
  • 'C' has 05 records.

 

So, we need show that the results of this sum is '11'.

 

>>> How to accomplish that?

  • Hi jr3151006 

     

    You can use something like the following:

     

    Measure = 

    VAR _1 = COUNTROWS ( 'TableA' )
    VAR _2 = COUNTROWS ( 'TableB' )
    VAR _3 = COUNTROWS ( 'TableC' )

    RETURN
    _1 + _2 + _3

     

    Hope this helps πŸ™‚

    Theo

     

5 Replies

  • TheoC's avatar
    TheoC
    Icon for Community Champion rankCommunity Champion

    Hi jr3151006 

     

    You can use something like the following:

     

    Measure = 

    VAR _1 = COUNTROWS ( 'TableA' )
    VAR _2 = COUNTROWS ( 'TableB' )
    VAR _3 = COUNTROWS ( 'TableC' )

    RETURN
    _1 + _2 + _3

     

    Hope this helps πŸ™‚

    Theo

     

  • Ok, tks, I'll try it in a few hours.

     

    Another 'basic' question, if the end user (how has obtained access via share) change some filter, that new measure will respect the filter applied or it will be fixed? 

  • jr3151006 If all those 3 sheets have same structure so combine them by creating a new table using UNION function.

    New Table = UNION(Sheet1,Sheet2,Sheet3)

     

    • jr3151006's avatar
      jr3151006
      Icon for Helper IV rankHelper IV

      Tks Tahreem24,

       

      but the tables structure are not the same.

       

      I was able to test with success the 'Teoc' advice.

       

      tks for all!