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
water-guy-5
Helper III
Helper III

Calculating a text column with certain parameters

I have a bunch of restuarant locations that need to be "checked" for regulation by the 15th of each month. Unfortunately, the way our data works is that each day when someone visits the restaurant for daily logging", they are forced to fill out either "inspection taken" or "not checked". As a result, location A might have 14 entries of "not checked" and 1 entry of "inspection taken".

A simple count function won't work as it makes the data appear that we don't check the restuarants often. Here is one of my current measures that counts if the # of times we have inspected an area

CALCULATE(COUNT(Restaurant[Status]), Restuarant[Response]="Not Checked").

I would like a measure that does a date range filter from the first day of the month - fifteenth day of the month, from there, if there is any entry that has "inspection taken" then I want a switch function that returns "Monthly Check Complete". If the first fifteen days are all "Not Checked", then I would like measure to return "Investigate".

Thanks!
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

In the Date slicer (which should be built from the Calendar Table) select 15 July 2021.  Try this measure

Measure = if(CALCULATE(COUNT(Restaurant[Status]), Restuarant[Response]="Not Checked",DATESBETWEEN('Calendar[Date],STARTOFMONTH(Calendar[Date]),MAX(Calendar[Date])))=15,"Investigate","Monthly Check Complete")

This measure should work if the only 2 entries that can appear in the Status column are "Not checked" and "Inspection taken"


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

In the Date slicer (which should be built from the Calendar Table) select 15 July 2021.  Try this measure

Measure = if(CALCULATE(COUNT(Restaurant[Status]), Restuarant[Response]="Not Checked",DATESBETWEEN('Calendar[Date],STARTOFMONTH(Calendar[Date]),MAX(Calendar[Date])))=15,"Investigate","Monthly Check Complete")

This measure should work if the only 2 entries that can appear in the Status column are "Not checked" and "Inspection taken"


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.