Forum Discussion
Create table with modifications based on existed one
Hi All,
I have T1 table with two columns: date and val.
date column ranges from period A to Per. B, but some dayes are missed in this period.
I need to create a new table T2 with same column names, but modified in such way: date column must include all days from period A to per. B and corresponding values of those days , missed in Table1's date column, must be zero.
giorgi_lommidd there are many posts which will help you to add date dimension in your model. Here is quick expression to add Date Dimension
On moelling tab, click New Table and add following expression, change date range as per your dataset
Dim Date = CALENDAR( DATE(2019,1,1), DATE(2019,12,31))
You will have new table in your model, now set relationship with Dim Date. Date column with your transaction table, it will be one to many , one on date side, many on transaction side.
Add new measure
Total Amount = SUM( TransactionTable[Column] ) + 0
Now add table visual, put Date column from dim date and Total Amount measure and you will see all the dates and missing dates will have zero value
3 Replies
- parry2kSuper User
giorgi_lommidd why not have date dimension in your model and link it with your t1 table and then write measure to have zero value for missing dates, you will see continuous dates from your date table in all the visualization.
- giorgi_lommiddHelper I
Thanks for responce,
Can you please provide example of dax code ?- parry2kSuper User
giorgi_lommidd there are many posts which will help you to add date dimension in your model. Here is quick expression to add Date Dimension
On moelling tab, click New Table and add following expression, change date range as per your dataset
Dim Date = CALENDAR( DATE(2019,1,1), DATE(2019,12,31))
You will have new table in your model, now set relationship with Dim Date. Date column with your transaction table, it will be one to many , one on date side, many on transaction side.
Add new measure
Total Amount = SUM( TransactionTable[Column] ) + 0
Now add table visual, put Date column from dim date and Total Amount measure and you will see all the dates and missing dates will have zero value