I want to create power bi DAX measure that enables me to switch between fiscal year and financial year using my sales data
Total Credit Card Spending by Year =
VAR YearType = SELECTEDVALUE('Year Type'[Year Type], "Calendar Year")
RETURN
SWITCH(
TRUE(),
YearType = "Calendar Year",
CALCULATE(
SUM('Credit Card'[Line Amount]),
VALUE(RIGHT('Calendar'[Calendar Year], 4)) = YEAR(TODAY())
),
YearType = "Fiscal Year",
CALCULATE(
SUM('Credit Card'[Line Amount]),
VALUE(RIGHT('Calendar'[Fiscal Year], 4)) = YEAR(TODAY())
)
)
1