Forum Discussion

LangeJan's avatar
LangeJan
Icon for Helper I rankHelper I
4 years ago

Count not working when joining with other table

 

Hi
I have two tables. 'CUSTOMERS' and 'REFERENCE'.
I have made a count of how many times a VATNUMBER occurs in 'CUSTOMERS'. The count works fine, right up until I add data from the 'REFERENCE' table.

 

 

Can anyone tell how I can keep the count even though I want to see data from both tables?

Thanks in advance.

 

VATNUM occurrences = CALCULATE(
COUNTROWS(AXtest_CUSTTABLE);
ALL(AXtest_CUSTTABLE);
VALUES(AXtest_CUSTTABLE[VATNUM])
)

Here the count works fine without data from 'REFERENCE' table


 

Here the count does not work with data TDCID from 'REFERENCE' table

 

 

5 Replies

    • LangeJan's avatar
      LangeJan
      Icon for Helper I rankHelper I

      Yes I have a relationship between the two tables. There is no data in Tdcid for the mentioned vatnumber.

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

    LangeJan 

    You can try

    VATNUM occurrences =
    CALCULATE (
        COUNTROWS ( AXtest_CUSTTABLE );
        ALL ( AXtest_CUSTTABLE );
        VALUES ( AXtest_CUSTTABLE[VATNUM] );
        REMOVEFILTERS ( References )
    )

     

     

     

    • LangeJan's avatar
      LangeJan
      Icon for Helper I rankHelper I

      tamerj1 Thanks for your suggestion. Unfortunately this does not solve the problem.

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

        LangeJan 

        Sorry for that. 
        try to CROSSFILTER the relationship to "None"

        Or otherwise, you can add it as measure not a column. Can you please share a screenshot of you data model (relationships) and provide the names of the tables and involved columns?