Hi!
I have two tables in my PowerPivot (see example below). The first one (Table A) shows different packages at different hotels and how much they cost. The second table (Table B) shows how much discount we can get from the different hotels. The discount is based on when the guest are staying there. So if we have a guest arriving the 1 of May at hotel A and taking the deluxe package for 7 days, they will get in total discount of 100 euros.
Calculation:
-10 € * 3 days (1/5-3/5)
-15 € * 2 days (4/5-5/5)
-20 € * 2 days(6/5-7/5)
=100 €
My big question is; How can I make a Dax-formula that will calculate how much discount the customer will get automatically?
I have only started with the formula =Calculate(sum(TableB[Discount]);Filter(TableB;TableA[Hotel] =Tableb[Hotel]);Filter(TableB;TableA[Package] =TableB[Package])).
The troubles comes when I want to make the dates as filters and calculate the dates between the different periods.
Hope that you guys can help me!
Thaaaaank you!
Table A
Date House Hotel Package Duration Price Total Discount
2016-05-01 A Standard 7 1000 ???
2016-05-01 A Deluxe 7 1500 ???
2016-05-16 B Standard 14 2500 ???
2016-05-16 B Deluxe 14 3000 ???
2016-05-30 A Standard 7 1500 ???
2016-05-30 A Deluxe 7 2700 ???
2016-06-13 A Standard 14 2600 ???
2016-06-13 A Deluxe 14 5000 ???
Table B
Hotel Package Discount Stay date from Stay date to
A Deluxe -10 2016-04-01 2016-05-03
A Deluxe -15 2016-05-04 2016-05-05
A Deluxe -20 2016-05-06 2016-06-30
A Standard -25 2016-05-01 2016-05-05
A Standard -20 2016-05-06 2016-06-30
B Deluxe -30 2016-04-01 2016-05-20
B Deluxe -15 2016-05-21 2016-06-30
B Standard -20 2016-05-01 2016-06-30
I have two tables in my PowerPivot (see example below). The first one (Table A) shows different packages at different hotels and how much they cost. The second table (Table B) shows how much discount we can get from the different hotels. The discount is based on when the guest are staying there. So if we have a guest arriving the 1 of May at hotel A and taking the deluxe package for 7 days, they will get in total discount of 100 euros.
Calculation:
-10 € * 3 days (1/5-3/5)
-15 € * 2 days (4/5-5/5)
-20 € * 2 days(6/5-7/5)
=100 €
My big question is; How can I make a Dax-formula that will calculate how much discount the customer will get automatically?
I have only started with the formula =Calculate(sum(TableB[Discount]);Filter(TableB;TableA[Hotel] =Tableb[Hotel]);Filter(TableB;TableA[Package] =TableB[Package])).
The troubles comes when I want to make the dates as filters and calculate the dates between the different periods.
Hope that you guys can help me!
Thaaaaank you!
Table A
Date House Hotel Package Duration Price Total Discount
2016-05-01 A Standard 7 1000 ???
2016-05-01 A Deluxe 7 1500 ???
2016-05-16 B Standard 14 2500 ???
2016-05-16 B Deluxe 14 3000 ???
2016-05-30 A Standard 7 1500 ???
2016-05-30 A Deluxe 7 2700 ???
2016-06-13 A Standard 14 2600 ???
2016-06-13 A Deluxe 14 5000 ???
Table B
Hotel Package Discount Stay date from Stay date to
A Deluxe -10 2016-04-01 2016-05-03
A Deluxe -15 2016-05-04 2016-05-05
A Deluxe -20 2016-05-06 2016-06-30
A Standard -25 2016-05-01 2016-05-05
A Standard -20 2016-05-06 2016-06-30
B Deluxe -30 2016-04-01 2016-05-20
B Deluxe -15 2016-05-21 2016-06-30
B Standard -20 2016-05-01 2016-06-30