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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors