This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hello everyone,
I need to calculate Return on assets ratio as annual but don't know how to write IF funcion that depends on month number in table below
Could you please help me with the formula marked in red?
Solved! Go to Solution.
Hi. I'll help you with the IF statement taking actual/current date regarding the row context of a visualization. I have added comments to help you. It would be a good idea to use variables. You can find your IF with variables and the __better_if that is kind of a better solution for that in case you want to replace it.
ROA =
VAR __current_date = SELECTEDVALUE( Table[Data] ) //Your table example specifies column data as date. This gets the current date in row context
VAR __month = MONTH (__current_date) //if your column is type date you can do this to get the month
VAR __if_condition =
IF(__month = 3, 4
, IF(__month = 6, 2
, IF(__month = 9, 1.3333, 1
)
)
)
VAR __better_if = // this would be a better way to handle the if
SWITCH (__month
, 3, 4
, 6, 2
, 9, 1.333
,1
)
RETURN
DIVIDE(
CALCULATE( SUM( UK_DB[Sum, Eur] ), UK_DB[Item] = "Net profit" )
, CALCULATE( SUM(UK_DB[Sum, Eur]), UK_DB[Item] = "Assets" )
) * __if_condition
I hope that helps,
Happy to help!
Hi. I'll help you with the IF statement taking actual/current date regarding the row context of a visualization. I have added comments to help you. It would be a good idea to use variables. You can find your IF with variables and the __better_if that is kind of a better solution for that in case you want to replace it.
ROA =
VAR __current_date = SELECTEDVALUE( Table[Data] ) //Your table example specifies column data as date. This gets the current date in row context
VAR __month = MONTH (__current_date) //if your column is type date you can do this to get the month
VAR __if_condition =
IF(__month = 3, 4
, IF(__month = 6, 2
, IF(__month = 9, 1.3333, 1
)
)
)
VAR __better_if = // this would be a better way to handle the if
SWITCH (__month
, 3, 4
, 6, 2
, 9, 1.333
,1
)
RETURN
DIVIDE(
CALCULATE( SUM( UK_DB[Sum, Eur] ), UK_DB[Item] = "Net profit" )
, CALCULATE( SUM(UK_DB[Sum, Eur]), UK_DB[Item] = "Assets" )
) * __if_condition
I hope that helps,
Happy to help!
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.