- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create a DAX calendar table and bring data in
I have a table that looks like this:
Date | Country | Result |
01-Jan | Japan | 1 |
01-Jan | Germany | 2 |
01-Jan | USA | 1.4 |
03-Jan | Germany | 5 |
03-Jan | USA | 2.3 |
07-Jan | USA | 3 |
08-Jan | Japan | 2 |
08-Jan | Germany | 2 |
08-Jan | USA | 7.1 |
I want to create a new table whose first column is a calendar. The second and third columns would show the data of the original table. It would look like this:
Date | Country | Result |
01-Jan | Japan | 1 |
01-Jan | Germany | 2 |
01-Jan | USA | 1.4 |
02-Jan | Japan | 0 |
02-Jan | Germany | 0 |
02-Jan | USA | 0 |
03-Jan | Japan | 0 |
03-Jan | Germany | 5 |
03-Jan | USA | 2.3 |
04-Jan | Japan | 0 |
04-Jan | Germany | 0 |
04-Jan | USA | 0 |
05-Jan | Japan | 0 |
05-Jan | Germany | 0 |
05-Jan | USA | 0 |
06-Jan | Japan | 0 |
06-Jan | Germany | 0 |
06-Jan | USA | 0 |
07-Jan | Japan | 0 |
07-Jan | Germany | 0 |
07-Jan | USA | 3 |
08-Jan | Japan | 2 |
08-Jan | Germany | 2 |
08-Jan | USA | 7.1 |
Does anyone know how to do this?
I created a calendar table with the following code
NewTable = CALENDAR ( min('Table'[Date]), max('Table'[Date]) )
I added the result with a column
ResultColumn = CALCULATE ( SUM ( 'Table'[Result] ), FILTER ('Table', 'Table'[Date] = NewTable[Date] ) )
But how do I add the column with the countries in there?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Anonymous
Please see the attached file as well
Regards
Zubair
Please try my custom visuals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Anonymous
You can create a CALCULATED TABLE transforming your Table into Desired Format.
Basically it Adds the missing dates and cross joins the dates with all the Countries that existed before that date
Assuming your TableName is Table1.
Go to Modelling Tab>>New Table
Calculated Table = VAR AllDates = CALENDAR ( MIN ( Table1[Date] ), MAX ( Table1[Date] ) ) VAR MissingDates = EXCEPT ( AllDates, VALUES ( Table1[Date] ) ) VAR temp = UNION ( ADDCOLUMNS ( MissingDates, "Country", BLANK (), "Result", 0 ), Table1 ) VAR temp1 = GENERATE ( SUMMARIZE ( temp, [Date] ), CALCULATETABLE ( FILTER ( SUMMARIZE ( temp, [Country] ), [Country] <> BLANK () ), FILTER ( temp, [Date] <= EARLIER ( [Date] ) ) ) ) RETURN ADDCOLUMNS ( temp1, "Result", VAR result = LOOKUPVALUE ( Table1[Result], Table1[Country], [Country], Table1[Date], [Date] ) RETURN IF ( ISBLANK ( result ), 0, result ) )
Regards
Zubair
Please try my custom visuals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Anonymous
Please see the attached file as well
Regards
Zubair
Please try my custom visuals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much 🙂

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
06-13-2024 12:36 AM | |||
09-26-2023 03:00 AM | |||
03-07-2024 06:29 AM | |||
06-01-2023 01:14 AM | |||
06-10-2024 05:54 AM |
User | Count |
---|---|
84 | |
78 | |
40 | |
40 | |
35 |