Forum Discussion
conditional relationship between tables
- 2 years ago
Hello,
In terms of modelling, I am using a simple star schema with 1 to many relationship between a dimension table that contains Cod_Prom - you can create this table by duplicating one of the tables and keeping only this column without duplicates
in terms of measure you can create the following:
Solution = IF( MAX(AGGR[date]) >= MAX(OFF[startdate]) && MAX(AGGR[date]) <= MAX(OFF[enddate]), CALCULATE( SELECTEDVALUE(AGGR[date]), TREATAS(VALUES(AGGR[cod_prom]), OFF[Codprom])))the result is the following (cod prom coming from the dimension and the measure created above)
I tested the scenario when the condion is not met. The date will not appear as shown below
If it answers your question, please mark my reply as the solution. Thanks!
Hello,
In terms of modelling, I am using a simple star schema with 1 to many relationship between a dimension table that contains Cod_Prom - you can create this table by duplicating one of the tables and keeping only this column without duplicates
in terms of measure you can create the following:
Solution =
IF(
MAX(AGGR[date]) >= MAX(OFF[startdate]) && MAX(AGGR[date]) <= MAX(OFF[enddate]),
CALCULATE(
SELECTEDVALUE(AGGR[date]),
TREATAS(VALUES(AGGR[cod_prom]), OFF[Codprom])))the result is the following (cod prom coming from the dimension and the measure created above)
I tested the scenario when the condion is not met. The date will not appear as shown below
If it answers your question, please mark my reply as the solution. Thanks!