Forum Discussion

BiJoe's avatar
BiJoe
Icon for Helper II rankHelper II
2 years ago
Solved

How to count facts from two dimensions?

This count of sales per employee per product should be really simple, but I have not found a simple way to do this in DAX. Appreciate any guidance to make a measure in the sales fact table. All tables are modeled in a star schema.

 

Employee dimension

PK EmployeeName
1Jane
2Joe
3Alice

 

Product dimension

PK ProductProduct name
1Wrench
2Gadget
3Clack

 

Sales fact table

FK EmployeeFK Product
11
22
22
33

 

Expected table visual

EmployeeProductNumber of sales
JaneWrench1
JoeGadget2
AliceClack1

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, BiJoe 

     

    Based on your information, here is my model relationship.

     

    I create a new measure named Number of sales

     

     

    Here is my DAX:

    Number of sales = COUNT('Sales fact table'[FK Employee])

     

     

     

    How to Get Your Question Answered Quickly 

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

    Best Regards

    Yongkang Hua

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, BiJoe 

     

    Based on your information, here is my model relationship.

     

    I create a new measure named Number of sales

     

     

    Here is my DAX:

    Number of sales = COUNT('Sales fact table'[FK Employee])

     

     

     

    How to Get Your Question Answered Quickly 

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

    Best Regards

    Yongkang Hua

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