This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Hello, To be honest, i even don't have a clue on how to define a correct subject for this problem.
I'll explain, please consider this table
Table
The idea is that we know by day what was the maximum out of order machine we had, we also know for that day how many machines where operational, so we can calculate the ratio. We also know the max time all the machines where simultaneous out of order.
Now is the goal that depending on the date selection we would by machine find the record with the highest Ratio.
But we would also want to display the corresponding MaxOutOofOrder and the Time
This means that when there is no date selection the report should show the first table and if 2/6/2017 is selected the second.
Ok The be even more demanding, it would be nice that in case 2 days have the same Ratio then we display the one woth the highest Time ...
Pleas feel free to help, kind regards, Harry
Solved! Go to Solution.
Hi @Anonymous,
Current power bi not support to create a dynamic calculate column/table based on filter/slicer.
In my opinion, I'd like to suggest you convert these columns to measure and use original location column as the group to calculate the related value.
Sample measures:
MAX OutOfOrder = MAX(Sheet2[MaxOutOfOrder]) MAX Day = var currentLocation = LASTNONBLANK(Sheet2[Location],Sheet2[Location]) var maxOrder=MAXX(FILTER(ALLSELECTED(Sheet2),Sheet2[Location]=currentLocation),[MaxOutOfOrder]) return MAXX(FILTER(ALLSELECTED(Sheet2),[Location]=currentLocation&&[MaxOutOfOrder]=maxOrder),[Day]) Related TotalOperational = var currentLocation = LASTNONBLANK(Sheet2[Location],Sheet2[Location]) var maxOrder=MAXX(FILTER(ALLSELECTED(Sheet2),Sheet2[Location]=currentLocation),[MaxOutOfOrder]) var maxDay=MAXX(FILTER(ALLSELECTED(Sheet2),[Location]=currentLocation&&[MaxOutOfOrder]=maxOrder),[Day]) return LOOKUPVALUE(Sheet2[TotalOperational],Sheet2[Location],currentLocation,Sheet2[MaxOutOfOrder],maxOrder,Sheet2[Day],maxDay) Related Ratio = var currentLocation = LASTNONBLANK(Sheet2[Location],Sheet2[Location]) var maxOrder=MAXX(FILTER(ALLSELECTED(Sheet2),Sheet2[Location]=currentLocation),[MaxOutOfOrder]) var maxDay=MAXX(FILTER(ALLSELECTED(Sheet2),[Location]=currentLocation&&[MaxOutOfOrder]=maxOrder),[Day]) return LOOKUPVALUE(Sheet2[Ratio],Sheet2[Location],currentLocation,Sheet2[MaxOutOfOrder],maxOrder,Sheet2[Day],maxDay) Related Time = var currentLocation = LASTNONBLANK(Sheet2[Location],Sheet2[Location]) var maxOrder=MAXX(FILTER(ALLSELECTED(Sheet2),Sheet2[Location]=currentLocation),[MaxOutOfOrder]) var maxDay=MAXX(FILTER(ALLSELECTED(Sheet2),[Location]=currentLocation&&[MaxOutOfOrder]=maxOrder),[Day]) return LOOKUPVALUE(Sheet2[Time],Sheet2[Location],currentLocation,Sheet2[MaxOutOfOrder],maxOrder,Sheet2[Day],maxDay)
Regards,
Xiaoxin Sheng
Hi @Anonymous,
You can refer to below formula to achieve your requirement:
Steps:
1. Use summarize function to group records to find the "MaxOutOofOrder" of each "Location".
2. Search for the max day by "Location" and "MaxOutOofOrder".
3. Use lookupvalue function to find out other columns based on above thress columns.
Table formula:
summaryTable = SELECTCOLUMNS( ADDCOLUMNS( SUMMARIZE(Sheet2,[Location], "MaxOutOfOrder",MAX(Sheet2[MaxOutOfOrder])), "Day",CALCULATE(MAX(Sheet2[Day]),FILTER(ALL(Sheet2),Sheet2[Location]=EARLIER([Location])&&Sheet2[MaxOutOfOrder]=EARLIER([MaxOutOfOrder])))), "Location",[Location], "Day",[Day], "MaxOutOfOrder",[MaxOutOfOrder], "TotalOperational",LOOKUPVALUE(Sheet2[TotalOperational],Sheet2[Location],[Location],Sheet2[Day],[Day],Sheet2[MaxOutOfOrder],[MaxOutOfOrder]), "Ratio",LOOKUPVALUE(Sheet2[Ratio],Sheet2[Location],[Location],Sheet2[Day],[Day],Sheet2[MaxOutOfOrder],[MaxOutOfOrder]), "Time",LOOKUPVALUE(Sheet2[Time],Sheet2[Location],[Location],Sheet2[Day],[Day],Sheet2[MaxOutOfOrder],[MaxOutOfOrder]))
Regards,
Xiaoxin Sheng
Hi Xiaoxin Sheng,
Wonrdefull, but this is static, the calculated table is 'created' when loading the data and doesn't change when filtering is applied.
But I will give it a try based on your DAX formulas ..
Hi @Anonymous,
Current power bi not support to create a dynamic calculate column/table based on filter/slicer.
In my opinion, I'd like to suggest you convert these columns to measure and use original location column as the group to calculate the related value.
Sample measures:
MAX OutOfOrder = MAX(Sheet2[MaxOutOfOrder]) MAX Day = var currentLocation = LASTNONBLANK(Sheet2[Location],Sheet2[Location]) var maxOrder=MAXX(FILTER(ALLSELECTED(Sheet2),Sheet2[Location]=currentLocation),[MaxOutOfOrder]) return MAXX(FILTER(ALLSELECTED(Sheet2),[Location]=currentLocation&&[MaxOutOfOrder]=maxOrder),[Day]) Related TotalOperational = var currentLocation = LASTNONBLANK(Sheet2[Location],Sheet2[Location]) var maxOrder=MAXX(FILTER(ALLSELECTED(Sheet2),Sheet2[Location]=currentLocation),[MaxOutOfOrder]) var maxDay=MAXX(FILTER(ALLSELECTED(Sheet2),[Location]=currentLocation&&[MaxOutOfOrder]=maxOrder),[Day]) return LOOKUPVALUE(Sheet2[TotalOperational],Sheet2[Location],currentLocation,Sheet2[MaxOutOfOrder],maxOrder,Sheet2[Day],maxDay) Related Ratio = var currentLocation = LASTNONBLANK(Sheet2[Location],Sheet2[Location]) var maxOrder=MAXX(FILTER(ALLSELECTED(Sheet2),Sheet2[Location]=currentLocation),[MaxOutOfOrder]) var maxDay=MAXX(FILTER(ALLSELECTED(Sheet2),[Location]=currentLocation&&[MaxOutOfOrder]=maxOrder),[Day]) return LOOKUPVALUE(Sheet2[Ratio],Sheet2[Location],currentLocation,Sheet2[MaxOutOfOrder],maxOrder,Sheet2[Day],maxDay) Related Time = var currentLocation = LASTNONBLANK(Sheet2[Location],Sheet2[Location]) var maxOrder=MAXX(FILTER(ALLSELECTED(Sheet2),Sheet2[Location]=currentLocation),[MaxOutOfOrder]) var maxDay=MAXX(FILTER(ALLSELECTED(Sheet2),[Location]=currentLocation&&[MaxOutOfOrder]=maxOrder),[Day]) return LOOKUPVALUE(Sheet2[Time],Sheet2[Location],currentLocation,Sheet2[MaxOutOfOrder],maxOrder,Sheet2[Day],maxDay)
Regards,
Xiaoxin Sheng
Great stuff, Thx.![]()
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 36 | |
| 33 | |
| 31 | |
| 21 | |
| 16 |
| User | Count |
|---|---|
| 66 | |
| 55 | |
| 31 | |
| 24 | |
| 23 |