Forum Discussion
JemmaD
Helper V
2 years agoCalculation group for changing date type
Hi there, I have visuals displaying data by month, week, and day/week where the x axis is either [start of month], [start of week] or [start of week] and [day of week]. I want to create a calculati...
- Anonymous2 years ago
Hi JemmaD ,
Try below steps:
1.create below date table:
Date = ADDCOLUMNS ( CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2024, 12, 31 ) ), "Year", YEAR ( [Date] ), "Quarter", ROUNDUP ( MONTH ( [Date] ) / 3, 0 ), "Month", MONTH ( [Date] ), "Week", WEEKNUM ( [Date] ), "Year-Quarter", YEAR ( [date] ) & "Q" & ROUNDUP ( MONTH ( [Date] ) / 3, 0 ), "Year-Month", YEAR ( [Date] ) * 100 + MONTH ( [Date] ), "Year-Week", YEAR ( [Date] ) * 100 + WEEKNUM ( [Date] ), "weeknum", WEEKDAY ( [Date] ) )2. create field parameters:
Parameter 2 = { ("Date", NAMEOF('Date'[Date]), 0), ("Month", NAMEOF('Date'[Month]), 1), ("Week", NAMEOF('Date'[Week]), 2) }Best Regards,
Adamk KongIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi JemmaD ,
Try below steps:
1.create below date table:
Date =
ADDCOLUMNS (
CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2024, 12, 31 ) ),
"Year", YEAR ( [Date] ),
"Quarter", ROUNDUP ( MONTH ( [Date] ) / 3, 0 ),
"Month", MONTH ( [Date] ),
"Week", WEEKNUM ( [Date] ),
"Year-Quarter",
YEAR ( [date] ) & "Q"
& ROUNDUP ( MONTH ( [Date] ) / 3, 0 ),
"Year-Month",
YEAR ( [Date] ) * 100
+ MONTH ( [Date] ),
"Year-Week",
YEAR ( [Date] ) * 100
+ WEEKNUM ( [Date] ),
"weeknum", WEEKDAY ( [Date] )
)
2. create field parameters:
Parameter 2 = {
("Date", NAMEOF('Date'[Date]), 0),
("Month", NAMEOF('Date'[Month]), 1),
("Week", NAMEOF('Date'[Week]), 2)
}
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.