I have an interesting table and i cant figure it out how to get 2nd minimum value or like something operation. Here is an example style of my table:
Column1 Column2 Column3
A A 0
A C 11
A D 7
B X 11
B B 0
A E 5
B Y 17
A F 4
I need to find minimum value for each A or B (from Column1) in Column3. But A=A (column1=column2) or B=B rows should not include in this MIN calculation. But found value for A should shown on row A=A or min value for B should shown on B=B row.
Also tryed this calculations:
IF([Column1]<>[Column2],CALCULATE(MIN([Column3]),ALL(myTable),myTable[Column2]=EARLIER(myTable[Column2])),0) –> returning same values from Column3 for each row.
IF([Column1]=[Column2],CALCULATE(MIN([Column3]),ALL(myTable),myTable[Column2]=EARLIER(myTable[Column2])),0) –> returning min values from Column3 for each A=A or B=B rows correctly. A=A or B=B rows contain data as value is 0. if i change it to 1, it returns 1 for this calculation. But i need other rows min value.
IF([Column1]=[Column2],CALCULATE(MAX([Column3]),ALL(myTable),myTable[Column1]=EARLIER(myTable[Column1])),0) –> this calculation works like a charm for MAX value. Because highest values will be in other rows always.
P.S: A=A or B=B rows default value is always 0 in Column3.
im stuck at this point =/ Thank you.
Use (in a calculated column):
where myTable[bColumn] is the calculated column
If you want the formula in a measure instead of a calculated column, use:
=CALCULATE(MIN([Column3]),FILTER(ALL(myTable),COUNTROWS(FILTER(myTable,myTable[Column1]=EARLIER(myTable[Column1])))),myTable[bColumn])
HTH!