Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
grggmrtn
Post Patron
Post Patron

Measure to determine weekly status based on data only from Monday and Tuesday

Our data is in four tables:

1. 'Date' made with DAX, with columns for week number, day, month, etc.

2. 'PersonID' with our unique client ID's [PersonID]

3. 'Services', with [PersonID], [Service], [Startdate], [Stopdate], and a [Dayslist] that creates a row for every 1 day increment between [Startdate] and [Stopdate].

4. 'Pause', with [PersonID], [Service], [Pause status], and [Pause date] which has 1 row for every day the Service has had [Pause status] True or False.

 

'Date' is related to 'Services'[Dayslist] and 'Pause'[Pause date] via many-to-one relation.

'PersonID' is related to [PersonID] to those tables, also many-to-one.

 

Which means that 'Services' and 'Pause' are not directly related to one another.

 

 

I need a measure [Billing] that will do the following per week:

For each [PersonID] that has a 'Services'[Dayslist] on Monday AND Tuesday in the same week, where 'Pause'[Pause status] <> True (also for both days), then YES for week number whatever, else NO

 

In my head the idea sounds simple, but there IS the possiblity that in 'Pause'a person can have two rows for the same day, one with [Pause status]=True and one with [Pause status]=False, which is a result of the person's pause starting or stopping on the same day. In this case I'm only concerned with the fact that one of the rows =False.

 

And again, 'Services' and 'Pause' aren't directly related to one another...

 

The result should be a simple table:

PersonID	WeekNum		Billing
1		10		Yes
1		11		Yes
1		12		No
2		10		No
2		11		Yes
2		12		No

Any takers? 🙂

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi  @grggmrtn ,

 

Recommend you delete the relationship between table Date and Pause on date fields, then create relationship between table Services and Pause , set the Cross filter direction of all relationships from Single to Both, which will treat the these tables as a single table . You can learn more : Create and manage relationships in Power BI Desktop .

 

I am not sure what desired result would you want, could you please share your sample data of these tables and desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Please read this post to get your answer quickly: How to Get Your Question Answered Quickly.

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xicai - so very sorry for the long wait for my reply. Summer vacations hit hard 😉

 

I'm attaching a .pbix file with sample data here (hope the link works). Please note that I've only one person in the data, but our "real" data contains many thousands. I have not added any visualisations to the .pbix file. And yes, I'm aware that the relations between tables is wonky 🙂

 

To understand our problem I just need to specify:

'Services'[DaysList] is every day that the person received a specific service.

'Pause'[Date] is the pause status of each date listed. 'Pause'[Pause]=0 means no pause, =1 is paused.

 

What I need is an analysis by week number:

If the person has a 'Services'[DaysList] that is equal to monday AND tuesday in the week,

AND

If the 'Pause'[Pause] for both of those days = 0

THEN

Billing (new column? measure?) for that week = TRUE, else FALSE

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors