Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello All. I am currently using the CALENDAR function to start my DateDim table. It is currently looking at the dates in my main table called 'TechDev DB'. The date field in the table that the formula is looking at only has one row per date, for example "1/1/2018", "2/1/2018", etc...
The formula I am currently using returns all the days in the month. I only want to return the first day of the month.
My current DAX is:
Dates =
CALENDAR (
DATE ( YEAR ( MIN ( 'TechDev DB'[Date] ) ), 1, 1 ),
DATE ( YEAR ( MAX ( 'TechDev DB'[Date] ) ), 12, 1 )
)
These are the date fields I want to return. (my data set in 2017 and 2018).
1/1/2018
2/1/2018
3/1/2018
4/1/2018
5/1/2018
6/1/2018
7/1/2018
8/1/2018
This is what the current formula is doing:
1/1/2018
1/2/2018
1/3/2018
1/4/2018
1/5/2018
1/6/2018
1/7/2018
1/8/2018
basically, all the days in the months, and I only want the 1st day of each month.
I appreciate your assitance.
Solved! Go to Solution.
Hi @Higgs11,
You can take the following steps to create the required date table.
1.Enter the data and create a Dates table using this formula.
Dates2 = GENERATE ( CALENDAR( DATE ( YEAR ( MIN ( 'TechDev DB'[Date] ) ), 1, 1 ), DATE ( YEAR ( MAX ( 'TechDev DB'[Date] ) ), 12, 1 )), VAR currentDay = [Date] VAR month = MONTH ( currentDay ) VAR year = YEAR ( currentDay ) RETURN ROW ( "MMYYDD", DATE(year,month,01) ) )
2. Create another new table based on Dates2
UN = VALUES(Dates2[MMYYDD])
For more details, please check the pbix as attached.
https://www.dropbox.com/s/a84umbt7vawp0r8/I%20only%20want%20to%202.pbix?dl=0
Regards,
Frank
Hi @Higgs11,
You can take the following steps to create the required date table.
1.Enter the data and create a Dates table using this formula.
Dates2 = GENERATE ( CALENDAR( DATE ( YEAR ( MIN ( 'TechDev DB'[Date] ) ), 1, 1 ), DATE ( YEAR ( MAX ( 'TechDev DB'[Date] ) ), 12, 1 )), VAR currentDay = [Date] VAR month = MONTH ( currentDay ) VAR year = YEAR ( currentDay ) RETURN ROW ( "MMYYDD", DATE(year,month,01) ) )
2. Create another new table based on Dates2
UN = VALUES(Dates2[MMYYDD])
For more details, please check the pbix as attached.
https://www.dropbox.com/s/a84umbt7vawp0r8/I%20only%20want%20to%202.pbix?dl=0
Regards,
Frank
This works! Thank you. So I have two Steps.
Step 1) Create a new table to extract all the dates in my main DataTable. This in nice because it captures all the dates in my main table.
DateTable1 =
GENERATE (
CALENDAR (
DATE ( YEAR ( MIN ( 'Table Name'[Date Field Name] ) ), 1, 1 ),
DATE ( YEAR ( MAX ( 'Table Name'[Date Field Name] ) ), 12, 1 )
),
VAR currentDay = [Date]
VAR month =
MONTH ( currentDay )
VAR year =
YEAR ( currentDay )
RETURN
ROW ( "MMYYDD", DATE ( year, month, 01 ) )
)
Step 2) Create a 2nd date table to only show one date for each month. My report is for monthly results and does nout use the days in the month.
DateTable2 =
VALUES ( DateTable1[MMYYDD] )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |