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

Create column based on two other columns

Hi everyone,

 

I have a questions, which might seems to be easy, but I was not able to handle it.

 

I have the following data:

PBI_SampleData_Source.png

 

CreationDate and ClosedDate is any date, ReportDate is always the last of a month or, if the last of a month is not reached yet, the current day (e.g. 10.02.2020). ID is an identifier and xyz a description.

 

My goal is now, to have a column which shows 0 or 1. 0 if the CloseDate is empty OR if the close date is within the same month (and year) of the ReportDate). If the month and the year of the report date is greater than the CloseDate or the CloseDate is not empty, it shall be 1. 

 

The overall goal, is to have a matrix, which shows for each ReportDate the count of the status within the ReportDate. In this example, it would be: 

(I only want to have the records displayed in the ReportDate which have the same month and year as the ClosedDate and not after the ClosedDate)

PBI_SampleData_DesiredResult.png

 

My idea with the column OutOfRange is to filter for OutOfRange = 0, in order to display only the values which are within the range.

 

Any help is appreciated.

Thank you in advance for your efforts

Best
J

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Please see the attached file with a solution.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Please check this blog how to deal with start and end dates. Very similar to your problem

 

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Anonymous
Not applicable

@amitchandak, very informative! Thank you for the link!

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Please see the attached file with a solution.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Hi @Mariusz,

 

thank you very much for your help and your effort! Exactly what I was looking for.

 

I have one additional question for understanding: It would be possible to use the column OutOfRange also (instead of the measure), but then I would just create the sum, regardless the ID? (I see that with the measure, I count the occurrence only once per month and status).

 

Thank you again,

Best

J

Hi @Anonymous 

 

I've adjusted it to use a Column, please see the attached.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

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.