Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Crossfiltering / Measure / Many-to-many with a bridge table

Dear Members of the Power BI Community

I am stock with the following case, hopefully somebody can give me a hint.

 

Initial situation

I have a dimCalender table and a second table with events "Eventtable". The goal is to filter the Eventtable respectively the time period by the date. So far so easy, each event has a start and end date. To avoid a many to many relationsship, I created a bridge table as a calculated table with the DAX-Code below:

HTBL_Events =
FILTER(
CROSSJOIN(
DFL_dimDate,
Eventtable
),
Eventtable[Start date] <= [Date] && Eventtable[End date] >= [Date]
)
 
This solution allows me to filter every single day. As a result I can see if an Event happens at this day or not. With this bridge table in use the following relationsships resulting:
 
dimDatetable 1:m Bridge table: There is one date field and several dates in the bridge table (reason: because of the duration of one event ID over several days the ID can have more than one date which is concerned)
Eventtable 1:m Bridge table: There is one ID as a primary key in Eventtable and more than one in the bridge table (reason: the event can have a duration of more than one day)
 
Actual Question
With the above decribed situation the problem arises that I am not able to filter the table Eventtable by the dimDatetable because of the dircation of the relationsship. So far so god, because of other tables and the thousands of recommendations I am searching for a proper solution to filter the table. My intended solution is a measure which activates the relationsship with the crossfilter function. But I am not able to generate the table with the columns: Start date / End date / Event title which are filtered over the dimTable with the support of the created bridge table.

All trials so far ended in the message that a measure is not able to show several values. But out of my actual understanding I have the feeling that this is more out of a lack of skills from my side than from dax and the possibilities from DAX.
 

 

 
I hope the discription is more or less clear, if you have any questions do not hesitate to comment. 😉

Thanks for your support and tipps
Mike

4 Replies