Forum Discussion

PBI-Newbie's avatar
PBI-Newbie
Icon for Helper I rankHelper I
2 years ago
Solved

add column to query to include missing items (DAX)

I have a query with all GL line items. Some of them are missing the vendor information. I would like to add a column to the query that takes the Accounting Document ID and adds the vendor to all distinct accounting documents. 

Example:

Accounting DocumentVendor IDVendor NameAmountGL code
100002000

Hill ltd.

2000

20000

10000 

 

500

75000

100012001

Light Ltd

1000

20000

100012001

Light Ltd

300

25000

10001  

500

76000

 

and I would need the new column to look like this:

Accounting DocumentVendor IDVendor NameAmountGL codeVendor added
100002000

Hill ltd.

2000

20000

2000
10000 

 

500

75000

2000
100012001

Light Ltd

1000

20000

2001
100012001

Light Ltd

300

25000

2001
10001  

500

76000

2001

 

How do I do this? Add a column to the query? or add a new table? I don't want to amend the original query, just add to it.

  • Either way you suggested works. If you choose to add a column, then you can use the following DAX:

    Vendor added = CALCULATE(MAX(Table[Vendor ID]), ALLEXCEPT(Table[Accounting Doccument]))

3 Replies

  • Either way you suggested works. If you choose to add a column, then you can use the following DAX:

    Vendor added = CALCULATE(MAX(Table[Vendor ID]), ALLEXCEPT(Table[Accounting Doccument]))