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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Have 1 filter for both column

Hi team,

 

From the table 1, I would like to have result as table below. However, the issue is with the location. If my out location is AAA, the out location is not AAA. The aim is to see the difference between in & out forthe same location. Any suggesstion is much apprecaited. Thanks

 

Table 1:

 

Car TypeOut LocationIn LocationDate
SedanAAABBBJan-23
SedanCCCAAAJan-23
SedanAAABBBJan-23
SedanAAACCCFeb-23

 

Result:

 

MonthLocationCar TypeOutInVar
Jan-23AAASedan211
1 ACCEPTED SOLUTION
Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Anonymous , in your data model you should have a single Dimension table with all the Locations.  Create Two relationships on this Dimension table to the Table Fact (i.e. your first table above).  After this you can create the followig DAX measures:

Out = 
   CALCULATE ( 
      COUNTROWS ( Fact Table ) , 
      USERELATIONSHIP( dim_Location[LocationKey] , FACT Table[Location Out] ) 
   ) 

In = 
   CALCULATE ( 
      COUNTROWS ( Fact Table ) , 
      USERELATIONSHIP( dim_Location[LocationKey] , FACT Table[Location In] ) 
   ) 

Var = [Out] - [In]

Your table is created by using the Dimension Location field in the second matrix.

View solution in original post

2 REPLIES 2
Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Anonymous , in your data model you should have a single Dimension table with all the Locations.  Create Two relationships on this Dimension table to the Table Fact (i.e. your first table above).  After this you can create the followig DAX measures:

Out = 
   CALCULATE ( 
      COUNTROWS ( Fact Table ) , 
      USERELATIONSHIP( dim_Location[LocationKey] , FACT Table[Location Out] ) 
   ) 

In = 
   CALCULATE ( 
      COUNTROWS ( Fact Table ) , 
      USERELATIONSHIP( dim_Location[LocationKey] , FACT Table[Location In] ) 
   ) 

Var = [Out] - [In]

Your table is created by using the Dimension Location field in the second matrix.

Anonymous
Not applicable

Thanks, it worked.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.