Forum Discussion
Convert new variable in Power Query to a column of table
I have dates in my table A, and I have another list of Dates in another table B.
If Date in A = any Date in B, then the column should be 1, else 0
I defined a variable for this - BL_Count = if List.Contains(Dates[WeekStart],WeekStart) then 1 else 0 (did not test this yet)
How to convert this to display as a column in my table A?
Thanks!
In power query you can do a merge between two tables, and expand table B and then add a custom column, if date of table b column is null then 0 else 1 Assuming after merge the date column from Table B is called TableB.Date
if [TableB.Date] = null the 0 else 1
3 Replies
- parry2k
Super User
Anonymous you can add a calculated column using following DAX expression in Table A
BI Count = IF ( TableA[Date] in VALUES ( TableB[Date] ), 1, 0 )- AnonymousNot applicable
Thanks for your quick response! I'm using Excel Power Query Editor, can you give me an equivalent formula in M?
- parry2k
Super User
In power query you can do a merge between two tables, and expand table B and then add a custom column, if date of table b column is null then 0 else 1 Assuming after merge the date column from Table B is called TableB.Date
if [TableB.Date] = null the 0 else 1