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

Measure dependent on slicer selection

Hi,

in a scenario where the pieces of a product are being stressed in an oven over time I want to calculate the remaining capacity of the ovens during a selected calendar week.


My tables are as follows
Stressing

ID Oven ID Product Start Date Pieces End Date Remaining Capacity
9Tango623.03.202012811.05.20200
11Tango711.05.20206429.06.202064
13Tango811.05.20204829.06.202080

I also have made a calculated column 'Remaining Capacity' = RELATED(Oven[Capacity]) - Stressing[Pieces]. A first attempt at solving my problem.

 

Oven

ID Oven Capacity
11Tango128

I hope the Headers are displayed properly.

 

A product and calendar table which have some more info which is not relevant right now.

 

The referenced Stressing table is for expanding the dates between start date and end date which I use for a slicer in which I can choose a single calendar week to filter by.

 

The relationships

RelationshipsRelationships

 

What I want now is probably a measure which calculates the remaining capacity of the ovens during the selected calendar week which I can then use in a visual. I already made it so that the visual shows the ovens in use during the selected calendar week. The number you can see is the sum of all the pieces that are being stressed in this oven but not limited to this calendar week but of all time. I'd like to replace this aggregation of pieces by the remaining capacity of the ovens.

Using the data from the aforementioned tables the calculation should be something like this

Remaining capacity = 128(Capacity of Oven Tango) - 64(Pieces of Stress with ID 11) - 48(Pieces of Stress with ID 13)

 

Kreis.PNG

 

A way to do it could be a measure that is dependent on the slicer selection which checks if there are multiple stresses in the same oven during the selected week and then calculates the remaining capacity.

 

Or maybe a calculated column in the stressing table with some IF conditions to check if the Oven ID is the same and the date as well and then calculate the remaining capacity.

 

 

Any help is greatly appreciated.

9 REPLIES 9
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try to change the one-to-many relationship(single) marked by red circle below to both.

1.jpg

Hope this helps.

 

Best Regards,

Giotto

Anonymous
Not applicable

@v-gizhi-msft 

I changed the relationship like you told me to but i don't see how this helps me. If you could elaborate on how this is beneficial to solving my problem I would be very grateful.

Relationships2.PNG

I am struggling with the DAX syntax for the measure.

Hi,

 

Could you please share your pbix file by OneDrive for Business?

This can let me help you further.

 

Best Regards,

Giotto

Anonymous
Not applicable

Unfortunately I can't send you the file. Please correct me if I am wrong but I think your idea was to create a measure with the FILTER function which returns the filtered 'Stressing' table and this I could use to check if there are multiple ovens with the same name in this new table?

I tried to implement this

Measure = FILTER(Stressing;RELATED(Calendar[CalendarWeek]))
It does not work though because the Calendar table is not handled as a related table to the Stressing table even though I changed both relationships Stressing <-> Stressing(referenced) and Stressing(referenced) <-> Calendar from single to both.

 

Maybe it would be possible to filter the Stressing table by using the already implemented Calendar Week Slicer.

@v-gizhi-msft 

Hi,

 

Any good progress?

 

Best Regards,

Giotto

Anonymous
Not applicable

Sadly I could not figure it out.

Hi,

 

According to your description, i think you want to filter 'Stressing' table by selecting week in 'Calendar' table.

If so, you should change the filter direction from 'Calendar' to 'Stressing', this is why i advise changing the relationship direction.

 

Best Regards,

Giotto

AllisonKennedy
Super User
Super User

@Anonymous  It sounds like you're very close to solving this yourself, but I'm curious what the Stressing (Reference) table is doing and where that Date column comes from? With the way your relationships are pointing and that intermediary table, that may be one of the roadblocks to not being able to get the capacity by date.

 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

 

If you found this post helpful, please give Kudos.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

https://sites.google.com/site/allisonkennedycv


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Hi @AllisonKennedy ,

I made the Stressing(referenced) table to expand my dates between the 'Start Date' and 'End Date' of my Stressing table so I could implement a slicer in which I can select a single calendar week. The idea was from another user from this community he sent me this video:               https://youtu.be/7kbNHz6SZHY

 

The calendar table I have is the ultmate calendar table from Avi Singh. In there the date column contains every day from the year 2020 and lots of more information like the Calendar week this day is in and so on.

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.