Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (47.2k points)

I have a problem that I need to solve which is somewhat simplistic but I can't work it out. Any help is much appreciated.

I have a dataset of a million records:

TransId, PersonGUID, Origin.

Origin has 2 options: [Credit, Current]

Now, I need to filter down to only those transactions where a PersonGUID has had both at least 1 row in Credit and Current.

I can do this somewhat easily in PythonPandas and load in the CSV but I don't want 2 datasets as I'll be building a dashboard around ALL data.

I am guessing a boolean logic calculated field but I can't work it out.

Thanks 

1 Answer

0 votes
by (17.6k points)
  • You need a conditional filter.

  • Drag PersonGUID to filter, and choose the tab Condition. You need to select the Formula and insert some formula that will give the result you want. Probably something like:

SUM(

IF Origin = 'Credit'   THEN 1 ELSE 0 END

) > 0

AND

SUM(

IF Origin = 'Current'    THEN 1 ELSE 0 END

) > 0

  • The first sum will be 0 if there's no 'Credit' for the user, and >0 otherwise. Same logic to the second.

  • This way, this calculation will be made to each PersonGUID, and you'll achieve what you need

Related questions

Browse Categories

...