Forum Discussion
Using IF to multiply columns according to date
- 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 🙂
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 🙂
Thank you very much, all data are in the same table. but what if data are in different table. and for more clarity, in a table, i have cost and sales per day, i want to find cost per day. before 2022, the cost was fixed at 10$ but after 2022, i have variable cost everyday they change
- SpartaBI4 years ago
Community Champion
Anonymous I need more info. Can you share a sample data (in tables, not pictures) but with all the columns in the table and the relationship between the two tables?
- Anonymous4 years agoNot applicable
the thing is the data is confidential i will try to explain.
i have 2 tables. both contain sales per day and only table one contains the cost.
i need to find the cost per day which is cosst*sales per day, but if date <2022 it was 10$ fixed, but after 2022, i have a different cost everyday and have to multiply the cost column with the sales per day column but its in different table. i created a realationship between the tables which is the date is the rlationship
- SpartaBI4 years ago
Community Champion
Anonymous still not sure 😞
Can you maybe create a fake data that you could upload as tables here, and also show exactly what is the relationship (who is the one side who is the many)