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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rohini
Helper I
Helper I

Can you dax with out ioin

 

Hello PBI Folks,

 

Could you throw some help at me with DAX and Model, with the below set up I got to work DAX2 working but seeking help on DAX1.

Do I need to change the model to make DAX1 work or will it work with no appropriate join between zone and employee table ?

 

 

 

Zone Table (JOIN - ZONE to ZONE)Department Table (JOIN - DEP to DEP)  TicketTable(JOIN -EMPID to EMPID) EmpTable
Zone Head ZoneDep DepEmpID ZoneEmpID
EastA EastD1 D1E1 EastE1
WestB EastD2 D1E2 EastE2
South C WestD3 D2E3 EastE3
NorthD SouthD4 D2E4 EastE4
MidWestE SouthD5 D4E5 SouthE5
MidEastD NorthD6 D5E6 SouthE6
   NorthD7 D7E7 NorthE7
   NorthD8 D8E8 NorthE8
   NorthD9 D9E9 NorthE9
   NorthD10 D10E10 EastE11
           
 DAX? DAX ?        
Zone AllEmployeeCount(from Emp Table)EmployeeCountwithTickets(from Ticket Table)        
East64        
West00        
South 22        
North43        
MidWest00        
MidEast00        
           
           
5 REPLIES 5
v-xicai
Community Support
Community Support

Hi @Rohini ,

 

For the relationship, recommend you create the star schema instead of circle schema, and change the Cross filter direction of relationships among the these tables above from Single to Both , which will take these tables treated as a single table.

 

Then you may create measure like DAX below.

 

DAX1= CALCULATE(COUNT(TicketTable[EmpID]),FILTER(ALLSELECTED(TicketTable), TicketTable[Dep]IN FILTERS (DepartmentTable[Dep])), FILTER(ALLSELECTED(DepartmentTable), DepartmentTable[Dep]IN FILTERS (TicketTable[Dep]) && DepartmentTable[Zone]IN FILTERS (ZoneTable[Zone])))



DAX2= CALCULATE(COUNT(EmpTable[EmpID]),FILTER(ALLSELECTED(EmpTable), EmpTable[EmpID]IN FILTERS (TicketTable[EmpID]) && EmpTable[Zone]IN FILTERS (ZoneTable[Zone])))

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AllisonKennedy
Super User
Super User

DAX always looks at the entire context of your report, including Joins. I'm not really clear what the department table is doing or why it's needed? 

 

You will need to join the Zone table to the Employee table in some way.

 

Without knowing more about your data and requirements I can't say for certain what the best suggestion is, but you need to consider which tables are 'fact' and which are 'dimension' and also how they are used in the report. You may need to create an inactive relationship and use the DAX USERELATIONSHIP, but I don't think that's needed here. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy 

 

Let me explain more.

 

Department table has more attributes that are required so it cannot go away.

 

Employee table is already joined to TicketTable and think both of them as transactional but they need to be joined for DAX2=EmployeeCountwithTickets(from Ticket Table)

 

Employee table could be joined to Zone table on Zone field , so this second active join is not allowed correct ?

 

So put me on the right track here with additional help.

 

1. Create an inactive join and write userrelationshop dax function for DAX1=AllEmployeeCount(from Emp Table)

Can you help roughly with that ?

 

2. Switch Emp to Ticket table join to inactive and Join Emp to Zone table active on Zone field and then write userrelationship dax function for DAX2=EmployeeCountwithTickets(from Ticket Table)

 

Zone is master table

Emp and Ticket tables are transactional



Which is the better performance tuned solution

 

Or other even better alternatives ?

I cannot use power query due to other constraints like live query mode.

Rohini
Helper I
Helper I

DAX1=AllEmployeeCount(from Emp Table)

DAX2=EmployeeCountwithTickets(from Ticket Table)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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