Forum Discussion

msmays5's avatar
msmays5
Icon for Helper II rankHelper II
5 years ago
Solved

Calculating Measure from Two Factless Fact Tables with Dimension

I have the below model. Each artcle has two type of tags: Geography and Topic. I'm trying to calculate the # of Articles each country has for each topic. While I feel like this should be easy, I'm st...
  • OwenAuger's avatar
    5 years ago

    Hi msmays5 

    With your tables/relationships set up as they are, you could write a measure as follows:

     

    # Articles filtered by Country and Topic = 
    CALCULATE ( 
        COUNTROWS ( Article ),
        CROSSFILTER ( 'Articles by Geography'[Article ID], Article[Article ID], Both ),
        CROSSFILTER ( 'Topic'[Article ID], Article[Article ID], Both )
    )

     

     

    This measure assumes that you would be using 'Zone Leads Mapping'[Country] and 'Article Keywords'[Keyword ID] as filters on your visual.

     

    The CROSSFILTER function with the Both argument is used to temporarily switch the relationships between your factless fact tables and Article to bidirectional, for the purpose of this measure. This effectively allows filters on 'Zone Leads Mapping' and 'Article Keywords' to filter the Article table.

     

    Simple example attached for reference.

     

    An alternative would be many:many relationships but I"m guessing you'd prefer not to do that given your model's setup.

     

    Regards,

    Owen