Forum Discussion
FrankMcQ
6 years agoFrequent Visitor
Creating relationships based on a sum calculation
Hi I have a table of milestones (because our financial calendar doesn’t match the regular calendar): Financial Year Name Period Start Date End Date 2018 ...
- 6 years ago
Hi FrankMcQ
Create a calendar table,
calendar = ADDCOLUMNS ( CALENDARAUTO (), "fiscal year", IF ( MONTH ( [Date] ) >= 10, YEAR ( [Date] ), YEAR ( [Date] ) - 1 ), "fiscal quarter", SWITCH ( TRUE (), MONTH ( [Date] ) >= 10 && MONTH ( [Date] ) <= 12, "Q1", MONTH ( [Date] ) >= 1 && MONTH ( [Date] ) <= 3, "Q2", MONTH ( [Date] ) >= 4 && MONTH ( [Date] ) <= 6, "Q3", MONTH ( [Date] ) >= 7 && MONTH ( [Date] ) <= 9, "Q4" ) )Create columns in this table
start date = CALCULATE(MIN('calendar'[Date]),ALLEXCEPT('calendar','calendar'[fiscal year],'calendar'[fiscal quarter])) end date = CALCULATE(MAX('calendar'[Date]),ALLEXCEPT('calendar','calendar'[fiscal year],'calendar'[fiscal quarter]))create relationship as below,
create a measure
Measure = SUM(invoices[Amount])Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-juanli-msft
6 years agoCommunity Support
Hi FrankMcQ
Create a calendar table,
calendar =
ADDCOLUMNS (
CALENDARAUTO (),
"fiscal year", IF ( MONTH ( [Date] ) >= 10, YEAR ( [Date] ), YEAR ( [Date] ) - 1 ),
"fiscal quarter", SWITCH (
TRUE (),
MONTH ( [Date] ) >= 10
&& MONTH ( [Date] ) <= 12, "Q1",
MONTH ( [Date] ) >= 1
&& MONTH ( [Date] ) <= 3, "Q2",
MONTH ( [Date] ) >= 4
&& MONTH ( [Date] ) <= 6, "Q3",
MONTH ( [Date] ) >= 7
&& MONTH ( [Date] ) <= 9, "Q4"
)
)
Create columns in this table
start date = CALCULATE(MIN('calendar'[Date]),ALLEXCEPT('calendar','calendar'[fiscal year],'calendar'[fiscal quarter]))
end date = CALCULATE(MAX('calendar'[Date]),ALLEXCEPT('calendar','calendar'[fiscal year],'calendar'[fiscal quarter]))
create relationship as below,
create a measure
Measure = SUM(invoices[Amount])
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
FrankMcQ
6 years agoFrequent Visitor
This is a great, many thanks. As I suspected, I just had a bad design - I think this is a much more elegant solution!