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
Anonymous
Not applicable

Count col A (date) Month Year matches col C (date) Month Year

Measure - Trying to Count the number of new starters each reporting period 

if month and year match both col A & col B  

 

Capture.PNG

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

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:

image.png

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.:

image.png

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 🙂





Did I answer your question? Mark my post as a solution!

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)




View solution in original post

2 REPLIES 2
dm-p
Super User
Super User

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:

image.png

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.:

image.png

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 🙂





Did I answer your question? Mark my post as a solution!

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)




Anonymous
Not applicable

thanks Daniel

The measure was exactly what i was after

appreciate your support

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.

Top Solution Authors