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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ToKo
Frequent Visitor

Return name for operation name in row context

Hi,

I have such expression in dax:

 

EVALUATE
FILTER (
    ADDCOLUMNS (
        DISTINCT ( table_name[order_num] ),
        "min_nr_oper",
            IF (
                CALCULATE (
                    MIN ( table_name[date] )
                )
                    <= TODAY () - 55
                        - WEEKDAY (
                            TODAY ()
                        ),
                CALCULATE (
                    MIN ( table_name[operation_num] )
                        & MIN ( table_name[name] )
                ),
                BLANK ()
            )
    ),
    [order_num] = "4005875120"
)

 

That returns me min value for operation in orders.

I would like to add column or concatenate with name for this operation but each time i receive problem - it returns me value for minimum name for this operation instead of current operation.

 

Expected return should be:

4005875120     225MYJ

 

But it is:

4005875120     225CECH

 

How can i fix this ?

 

 

 

 

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @ToKo ,

 

What is your table 'table_name' looks like? What is your current operation mean? Could you please provide a simple example about this(after removing sensitive data)?

According to my knowledge, this issue may caused by:

 

CALCULATE (
                    MIN ( table_name[operation_num] )
                        & MIN ( table_name[name] )
                )

 

Please try:

 

EVALUATE
FILTER (
    ADDCOLUMNS (
        DISTINCT ( table_name[order_num] ),
        "min_nr_oper",
            IF (
                CALCULATE (
                    MIN ( table_name[date] )
                )
                    <= TODAY () - 55
                        - WEEKDAY (
                            TODAY ()
                        ),
                CALCULATE (
                    MIN ( table_name[operation_num] )
                )
                 & MIN ( table_name[name] ),
                BLANK ()
            )
    ),
    [order_num] = "4005875120"
)

If you want to understand context transaction, please refer to:

Understanding Context Transition - SQLBI 

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @v-jianboli-msft ,

table_name below:

 

 

order_num	date	operation_num	name
4005875120	2022-06-13	225	MYJ
4005875120	2022-06-18	230	SLU
4005875120	2022-06-19	235	MYJ
4005875120	2022-06-19	245	H/T 1
4005875120	2022-06-19	250	H/T 1
4005875120	2022-06-21	255	H/T 1
4005875120	2022-06-24	270	H/T 1
4005875120	2022-06-25	275	H/T 1
4005875120	2022-06-25	279	K.KOP1
4005875120	2022-06-29	281	K.KOP2
4005875120	2022-06-29	285	H/T 1
4005875120	2022-06-29	319	K.KOP1
4005875120	2022-07-04	321	K.KOP2
4005875120	2022-07-05	325	H/T 1
4005875120	2022-07-05	330	H/T 1
4005875120	2022-07-06	335	H/T 1
4005875120	2022-07-06	340	H/T 1
4005875120	2022-07-06	344	K.KOP1
4005875120	2022-07-09	346	K.KOP2
4005875120	2022-07-09	350	H/T 1
4005875120	2022-07-09	355	H/T 1
4005875120	2022-07-09	358	H/T 1
4005875120	2022-07-10	360	H/T 1
4005875120	2022-07-10	375	FAZ
4005875120	2022-07-11	380	KEL2
4005875120	2022-07-11	385	CECH
4005875120	2022-07-15	400	MAZ
4005875120	2022-07-16	460	KEL2
4005875120	2022-07-17	480	KEL2
4005875120	2022-07-17	495	CECH
4005875120	2022-07-18	500	#N/A

 

 

I tried your code but it returns min for entire operation name which is #N/A i want to return value for 225 operation - MYJ.

I will carefully analyze Context Transition. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.