Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have 3 tables: Employee, Transactions and Date
in the table employee, we concatenate the monthly generated files where the unique field ID=employee_id+"_"+year(date)+"_"+month(date)
The table Transactions that is related to the Table Employee (1,*)
and there is a table Date related to the Employee Table (1,*)
And I have some slicers as follows:
Here is what I want do:
I want to display using CARDS while considering the selected values within the slicers:
** Number of Present Employees
** Number of Absent Employees
** Number of left Employees (an employee is considered as left if he left internallly the selected departement or the direction or he left the company)
** Number of transactions realized by present employees
** Number of transactions realized by Absent employees
** Number of transactions realized by left employees
Thanks of you help
Solved! Go to Solution.
Here's a step-by-step guide:
Number of Present Employees:
Present Employees = COUNTROWS(FILTER(Employee, Employee[Status] = "Present"))
Number of Absent Employees:
Absent Employees = COUNTROWS(FILTER(Employee, Employee[Status] = "Absent"))
Number of Left Employees:
Left Employees =
CALCULATE(
COUNTROWS(FILTER(Employee, Employee[Status] = "Left")),
USERELATIONSHIP(Employee[DateID], Date[DateID])
)
Number of Transactions by Present Employees:
Transactions by Present Employees =
CALCULATE(
COUNTROWS(FILTER(Transactions, RELATED(Employee)[Status] = "Present")),
ALLSELECTED(Transactions)
)
Number of Transactions by Absent Employees:
Transactions by Absent Employees =
CALCULATE(
COUNTROWS(FILTER(Transactions, RELATED(Employee)[Status] = "Absent")),
ALLSELECTED(Transactions)
)
Number of Transactions by Left Employees:
Transactions by Left Employees =
CALCULATE(
COUNTROWS(FILTER(Transactions, RELATED(Employee)[Status] = "Left")),
ALLSELECTED(Transactions)
)
Make sure to replace Status with the actual field that indicates the employee's status (Present, Absent, Left). Also, adjust the relationships in your model accordingly.
After creating these measures, you can add them to your report and use the slicers to dynamically filter the results based on the selected values.
Remember to customize the DAX measures based on your actual data model and field names.
Here's a step-by-step guide:
Number of Present Employees:
Present Employees = COUNTROWS(FILTER(Employee, Employee[Status] = "Present"))
Number of Absent Employees:
Absent Employees = COUNTROWS(FILTER(Employee, Employee[Status] = "Absent"))
Number of Left Employees:
Left Employees =
CALCULATE(
COUNTROWS(FILTER(Employee, Employee[Status] = "Left")),
USERELATIONSHIP(Employee[DateID], Date[DateID])
)
Number of Transactions by Present Employees:
Transactions by Present Employees =
CALCULATE(
COUNTROWS(FILTER(Transactions, RELATED(Employee)[Status] = "Present")),
ALLSELECTED(Transactions)
)
Number of Transactions by Absent Employees:
Transactions by Absent Employees =
CALCULATE(
COUNTROWS(FILTER(Transactions, RELATED(Employee)[Status] = "Absent")),
ALLSELECTED(Transactions)
)
Number of Transactions by Left Employees:
Transactions by Left Employees =
CALCULATE(
COUNTROWS(FILTER(Transactions, RELATED(Employee)[Status] = "Left")),
ALLSELECTED(Transactions)
)
Make sure to replace Status with the actual field that indicates the employee's status (Present, Absent, Left). Also, adjust the relationships in your model accordingly.
After creating these measures, you can add them to your report and use the slicers to dynamically filter the results based on the selected values.
Remember to customize the DAX measures based on your actual data model and field names.
User | Count |
---|---|
25 | |
11 | |
8 | |
7 | |
6 |
User | Count |
---|---|
24 | |
13 | |
12 | |
10 | |
6 |