Forum Discussion

PBI5851's avatar
PBI5851
Helper V
6 years ago

Incorrect count results

I have three tables in the relationship as follows. 

Date 

Account

ItemDetail

 

Date.Date (1:Many) Account.AccountDate (inactive relation)

Date.Date (1:Many) Itemdetail.AccountDate (inactive relation)

Date.Date (1:Many) Itemdetail.itemPurchasedate (inactive relation)

Account.ID (1:Many) Itemdetail.AccountID (active relation)

 

Account Table

AccountIDAccountDateAccountName
AC1231/1/2020HPC
AC2341/10/20MBC
AC3451/11/20FED
AC4561/15/20DEF
AC5671/16/20MND

 

ItemDetail Table

ItemIDItemNameAccountIDAccountDatePurchasestatusPurchaseDate
IT678ShoesHPC1/1/20Complete2/1/20
IT667BeltsHPC1/1/20Hold1/10/20
IT567MasksHPC1/1/20Complete1/20/20
IT777TeesHPC1/1/20Complete1/20/20
IT879WatchHPC1/1/20Complete1/15/20
IT444BandHPC1/1/20Schedule1/10/20

 

The Goal is to create a multirow card with counts from the Account and the Item table, but based of the Account date. Now i am able to get the data for Account data, but the counts from the item table are incorrect. Not sure what am i missing. 

 

For January Counts

Account Counts : calculate(counta(Accountid), userelationship (Date.Date, Account.Accountdate)) - This gives me 5

Item Counts: Calculate(counta(Itemid), filter(Itemdetail, purchasestatus = "Complete"), userelationship (date.date, itemdetail.accountdate) - this gives me 2, rather than 4. 

 

Please advise what am i missing. 

2 Replies

  • Oddly.. if i change the Item Counts forumula to

     

    Calculate(counta(Itemid),  userelationship (date.date, itemdetail.accountdate) ) i get the complete row count which is correct as per the raw table, but i need just the complete.