Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

How to make 2 dims tables affect each other through a fact table

Hi all
I have the follwoing model : 

Hadi2021_0-1698520002713.png

I want to be able to clalcute Gender distribution depend on Year and month ..
As you see Dim Employees and Dim Calendar have no direct connection between each other , so I think this should be done through the fact table Fact Departments.
The relation is (one to many) ..
Thanks in advance
Regards

1 ACCEPTED SOLUTION

Hi, @Anonymous 

 

just adjust table and column name

try below code 

result =
   calculate(
      sum('dim employees'[gender]),
      'dim employees'[gender]="male",
       crossfilter('fact departments'[employee_bk],dim employees'[employee_bk],both)
        )

 

 

View solution in original post

6 REPLIES 6
ThxAlot
Super User
Super User

If you wish to put your skill to the next level, read artiles on "Expanded Table in Power BI", such as this one:

Expanded tables in DAX - SQLBI

 

Keep your 1:* relationshipes in the star schema as it is and apply expanded table knowledge to the calculation to implement filtering from many end to 1 end (fact table filters dim table). 



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



Dangar332
Super User
Super User

Hi, @Anonymous 

 

you can change filter direction to both side manually in  model view without changing relationship b/w fact table and dimension table

 

Dangar332_0-1698521204867.png

 

Anonymous
Not applicable

Thank you 
I cant change the relationship direction , this is a very big model and changing relaionship direction will cause many issues 🙂 

Dangar332
Super User
Super User

Hi, @Anonymous 

 

make *-*(many to many) relationship bw fact department and dim employee

 

or

 

other wise  in your dax code use crossfilters function to change direction of filter 

 

Anonymous
Not applicable

Thank you 
I cant change the relationship direction , this is a very big model and changing relaionship direction will cause many issues .. 
Could you help me writing the DAX scripte to get the total number of 'male' when using crossfilters function ?
Thanks in adavnce 
Regards 

Hi, @Anonymous 

 

just adjust table and column name

try below code 

result =
   calculate(
      sum('dim employees'[gender]),
      'dim employees'[gender]="male",
       crossfilter('fact departments'[employee_bk],dim employees'[employee_bk],both)
        )

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.