Forum Discussion
Anonymous
4 years agoNot applicable
Using IF to multiply columns according to date
Hello, i am trying to multiply 2 columns say cost and number of sales according to the date. so if date is before 2022, the cost is 10 and fixed but if the date is in 2022 or later, i calculate the g...
- 4 years ago
Anonymous missing info about your model, but let's try (assuming you have all the columns in one table):
In case yor need a calculate column than adjust this code to your model needs:Column = Table[Quantity] * IF( YEAR('Table'[Date]) < 2022, 10, Table[Cost])
In case it's a measure go with this:Measure = SUMX( 'Table', Table[Quantity] * IF( YEAR('Table'[Date]) < 2022, 10, Table[Cost]) )
In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos 🙂
SpartaBI
4 years agoCommunity Champion
Anonymous missing info about your model, but let's try (assuming you have all the columns in one table):
In case yor need a calculate column than adjust this code to your model needs:
Column = Table[Quantity] * IF( YEAR('Table'[Date]) < 2022, 10, Table[Cost])
In case it's a measure go with this:
Measure =
SUMX(
'Table',
Table[Quantity] * IF( YEAR('Table'[Date]) < 2022, 10, Table[Cost])
)
In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos 🙂
Anonymous
4 years agoNot applicable
like i have sales per day in this table but cost in another table