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.
Good afternoon everyone,
This table is named "employees"
So I have the following problem:
The column "Fin.Ult Contr" shows the date when the employee was hired and the column "Nueva Fecha" shows when the same employee was fired.
I'd like to know how many employees do I had working when I make a date filter selecting a minimum date (when the employees got hired) and a maximum date (when the employees got fired)
Is it necessary to create a calendar table to connect that two columns?
Many thanks in advance,
Kind regards,
Adrian
Solved! Go to Solution.
@Anonymous ,
I apologize for the mistake above, please modify the measure as below
Result = VAR Min_Date = CALCULATE ( MIN ( Calendar[Date] ), ALLSELECTED ( Calendar ) ) VAR Max_Date = CALCULATE ( MAX ( Calendar[Date] ), ALLSELECTED ( Calendar ) ) RETURN COUNTROWS ( FILTER ( employees, employees[Fin.Ult Contr] >= Min_Date && employees[Nueva Fecha] <= Max_Date ) )
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous ,
You can create a measure using dax below:
Result = VAR Min_Date = CALCULATE ( MIN ( Calendar[Date] ), ALLSELECTED ( Calendar ) ) VAR Max_Date = CALCULATE ( MAX ( Calendar[Date] ), ALLSELECTED ( Calendar ) ) RETURN COUNTROWS ( FILTER ( employees, employees[Fin.Ult Contr] <= Min_Date && employees[Nueva Fecha] >= Max_Date ) )
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-yuta-msft,
I've tried your DAX but as you can see, it's not throwing any data back even when all the dates are selected:
I don't know but problably it's because of how the tables are linked currently (Fin Ult.Contr & Nueva Fecha Corregida are both linked to Date):
By the way, I've tried the following measure with both of the links being inactive but again, it's not throwing back back the result I'm looking for:
@Anonymous ,
I apologize for the mistake above, please modify the measure as below
Result = VAR Min_Date = CALCULATE ( MIN ( Calendar[Date] ), ALLSELECTED ( Calendar ) ) VAR Max_Date = CALCULATE ( MAX ( Calendar[Date] ), ALLSELECTED ( Calendar ) ) RETURN COUNTROWS ( FILTER ( employees, employees[Fin.Ult Contr] >= Min_Date && employees[Nueva Fecha] <= Max_Date ) )
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
99 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |