Forum Discussion
Generate calculated table containing rows where count of a value is greater 0 for each user
For your question "so then it would be a record count? (since the field is true/false) meaning that if 0 contacts you want to count False and only false?".
Almost - I need the list of users that have False for EVERY contact_method.
Another way to look at it (I've added the campaign column in this example - just for context since this table is tied to others via the campaign:
TABLE_A:
campaign user_id contact_method confirmed
X 123 email False
X 123 text False
X 321 email True
X 321 text False
So for my calculated table, I'm looking to get the following result:
campaign user
X 123
I felt it would be kind of odd to stick a calculated column in TABLE_A, because whle the data exists in TABLE_A to determine which users did not confirm at all, I tend to think of keeping calculated/summary data separate from non calculated.
It would be easier for me to revert to SQL logic rather than DAX for something like this. I would:
a. created a calculated table: TableFalse that is just the false records
b. created a calculated table: TableTrue that is just the true records
c. do an outer join on the ID field of TableFalse to TableTrue so all False records result
.....in this resulting table some rows will have the TableTrue fields as blanks
d. create a calculated table: NoMethod that filters out the records with blank TableTrue fields (only 1 field is needed)
this might not get you quite there - - air code and haven't completely thought thru every possible variation.....but will get you close
am pretty sure I forgot to include Distinct.... you'll want 1 record per ID in each table true/false......
- jkrewpbi10 years agoFrequent Visitor
I've created two tables with something like the following:
calc_conf_false = FILTER('TABLE_A','TABLE_A'[confirmed]=FALSE())
calc_conf_false = FILTER('TABLE_A','TABLE_A'[confirmed]=TRUE())
But when I attempt to perform a left outer join I get an 'No common join columns detected' error. They have the same number of columns.
calc_joined_conf_falsetrue = NATURALLEFTOUTERJOIN(calc_conf_false,calc_conf_true)
Now here's where I'm treading into newish territory. I can do this via SQL but I haven't created a join as you mentioned in PowerBI before, so I'm not quite certain how it's automatically trying to join these tables togther.
I'm tackling both approaches on this thread since I can see cases where I need to break out data in Power BI that comes from non-relational structures. So in this case, I can see breaking out multiple tables from one. Am I totally on the wrong path the way I'm creating the calculated tables to begin with, perhaps?