[PowerPivot] Lookup between dates

rareba

New Member
Joined
Mar 7, 2016
Messages
1
Hello!
I've this table:
https://dl.dropboxusercontent.com/u/9510624/Cattura.PNG
What i need to do is match the right CommInt with the date of the ticket.
For example, the ticket date is 15/07/2015 so the commission used will be the one of the issuing company for that specific period (i cannot use years since some companies have non-standard commission periods).
DataInizioComm means Starting Day, while DataFineComm means Ending Day.
As for now i tried to do:

Code:
=IF([TipoTratta]="I";
CALCULATE(
LOOKUPVALUE(VistaCommissioni[CommInt];VistaCommissioni[CodiceCompagnia];
Vantravel[CodiceCompagnia]);VistaCommissioni[CodiceCompagnia]=Vantravel[CodiceCompagnia];
FILTER(VALUES(Vantravel[DataEmissione]);VistaCommissioni[DataInizioComm]<=Vantravel[DataEmissione] && VistaCommissioni[DataFineComm] >= Vantravel[DataEmissione]));

CALCULATE(
LOOKUPVALUE(VistaCommissioni[CommNaz];VistaCommissioni[CodiceCompagnia];
Vantravel[CodiceCompagnia]);VistaCommissioni[CodiceCompagnia]=Vantravel[CodiceCompagnia];
FILTER(VALUES(Vantravel[DataEmissione]);VistaCommissioni[DataInizioComm]<=Vantravel[DataEmissione] && VistaCommissioni[DataFineComm] >= Vantravel[DataEmissione]))

)

With no luck :(

I humbly beg for help at this point!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,224,154
Messages
6,176,731
Members
452,740
Latest member
MrCY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top