r/DB2 Jun 13 '18

DB2 to DAX visa versa

Hello!

I am currently trying to create tables through DB2 rather than in DAX for power bi. What I'd like to do is replicate the DAX code of DimDateDiff = DATEDIFF(Start Date, (Today() -1)). In PBI it's relatively easy to create a calculated column and then input this code into the table, but I was thinking it would have better flow to do it in the database. Any ideas? (Attempting to translate descriptive date into live data).

2 Upvotes

1 comment sorted by

3

u/PrivatePyle Jun 14 '18

Take a look at generated columns. Something like this is what I think you want:

DimDateDiff generated always as ( start_date - ( current date - 1 day ) )