Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello folks
I have 2 tables, a date table and a work order table.
I want to calculate the sum of a field called 'Total', from the work order table.
However I only want it to sum the values based on the MAX date in a field 'date first completed' in the work order table.
Additionally though I want it to sum all the values in that week, based on the field 'start of week' from the date table.
There is an inactive relationship between 'date' in the date table and 'date first completed' in the work order table.
What sort of DAX measure would I need for this please I'd be ever so grateful for any suggestions.
Thanks
Ian
Bumping this for some assistance
Hi,
Share some data and show the expected result.
@Anonymous Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Please see the attached images of example tables - the Date Table is the one in my model and the other is just an example of the 2 columns I am referencing.
In the Work Order table the MAX 'date first completed' will never be greater than yesterday's date. So, no matter what day of the week it is today I would like to sum the 'Net Total' column right the way back to the 'Start of Week' from the date table - where the 'Start of Week' corresponds to MAX of 'Date First Completed'.
E.g. today I would like the values summed from 23rd January onwards (i.e. the 'Start of Week' value that corresponds to the 'Date First completed')
however were the MAX value of 'Date First Completed' the 17th January then I would like all values summing from the 16th January onwards.
I hope this is clearer and appreciate the assistance!
Here's a calculation that seems to be what you are looking for:
https://blog.enterprisedna.co/calculate-previous-weeks-sales-advanced-dax-in-power-bi/
Sadly this didn't work either
Hi, thank you so much for the reply!
This doesn't work sadly....it returns a much much higher value than anticipated...
Could you please try using ALLSELECTED() instead of ALL()
Thank you; this didn't work either. I've posted some screen shots of the items so hopefully that helps. Thank you so much for your assistance!
Hope this helps
SUMX(
FILTER(
ALL(WorkOrder),
MAX(WorkOrder[date first completed]) >= MIN(Date[start of week]) &&
MAX(WorkOrder[date first completed]) <= MAX(Date[start of week])
),
WorkOrder[Total]
)
User | Count |
---|---|
127 | |
108 | |
99 | |
63 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |