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.
Measure - Trying to Count the number of new starters each reporting period
if month and year match both col A & col B
Solved! Go to Solution.
Hi @Anonymous,
I've replicated your table and called it Report, so you might need to tailor the below according to how your table is named.
This can be solved in a number of ways - the approach I would use, to keep calculation logic simple would be:
1. Create a New Starter Column
Create a column in the table as follows:
New Starter = INT(
MONTH(Report[Report Period]) = MONTH(Report[Entry Date])
&& YEAR(Report[Report Period]) = YEAR(Report[Entry Date])
)
This returns 1 if the employee's entry date matches your reporting period, and 0 if not. Here's how this looks in your table:
2. Create a # New Starters Measure
Now, add the following measure to your table:
# New Starters = SUM(Report[New Starter])
This will ensure that whatever your filter context is, the amounts should tally, e.g.:
Just Wanting a Measure?
Again, there's a few ways to handle this. Here's an example that combines the approach above and doesn't need the column (essentially putting the logic into a SUMX iterator):
# New Starters =
SUMX(
Report,
INT(
MONTH(Report[Report Period]) = MONTH(Report[Entry Date])
&& YEAR(Report[Report Period]) = YEAR(Report[Entry Date])
)
)
As a heads-up for any future DAX questions, a lot more people frequent the DAX Commands and Tips forum and you may be able to get a faster and wider variety of responses.
I hope this solves your challenge. Good luck with implementing!
Daniel
If my post helps, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @Anonymous,
I've replicated your table and called it Report, so you might need to tailor the below according to how your table is named.
This can be solved in a number of ways - the approach I would use, to keep calculation logic simple would be:
1. Create a New Starter Column
Create a column in the table as follows:
New Starter = INT(
MONTH(Report[Report Period]) = MONTH(Report[Entry Date])
&& YEAR(Report[Report Period]) = YEAR(Report[Entry Date])
)
This returns 1 if the employee's entry date matches your reporting period, and 0 if not. Here's how this looks in your table:
2. Create a # New Starters Measure
Now, add the following measure to your table:
# New Starters = SUM(Report[New Starter])
This will ensure that whatever your filter context is, the amounts should tally, e.g.:
Just Wanting a Measure?
Again, there's a few ways to handle this. Here's an example that combines the approach above and doesn't need the column (essentially putting the logic into a SUMX iterator):
# New Starters =
SUMX(
Report,
INT(
MONTH(Report[Report Period]) = MONTH(Report[Entry Date])
&& YEAR(Report[Report Period]) = YEAR(Report[Entry Date])
)
)
As a heads-up for any future DAX questions, a lot more people frequent the DAX Commands and Tips forum and you may be able to get a faster and wider variety of responses.
I hope this solves your challenge. Good luck with implementing!
Daniel
If my post helps, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
thanks Daniel
The measure was exactly what i was after
appreciate your support
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 |
---|---|
6 | |
2 | |
2 | |
1 | |
1 |