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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Search for the Sea Value serca

Good afternoon.

I have two tables in one the daily sales in pesos and in another the tc, I need to put the tc in the sale, the problem is that not all the quote dates are and I need to search for the next value to complete all the cells in the sale table

Leo3722_0-1649543953065.png

Thank you very much

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

According to your statement, I think you want to get TC from the nearest [Fecha cotizacion].

Try this code.

TC = 
VAR _NEARST_DATE =
    MAXX (
        FILTER ( Table2, Table2[Fecha cotizacion] <= EARLIER ( Table1[Fecha Origen] ) ),
        Table2[Fecha cotizacion]
    )
RETURN
    CALCULATE (
        SUM ( Table2[Venta] ),
        FILTER ( Table2, Table2[Fecha cotizacion] = _NEARST_DATE )
    )

My Sample is as below.

Table1:

RicoZhou_1-1649752540599.png

Table2:

RicoZhou_0-1649752532777.png

Result is as below.

RicoZhou_2-1649752567607.png

 

Best Regards,
Rico Zhou

 

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

 

 

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

According to your statement, I think you want to get TC from the nearest [Fecha cotizacion].

Try this code.

TC = 
VAR _NEARST_DATE =
    MAXX (
        FILTER ( Table2, Table2[Fecha cotizacion] <= EARLIER ( Table1[Fecha Origen] ) ),
        Table2[Fecha cotizacion]
    )
RETURN
    CALCULATE (
        SUM ( Table2[Venta] ),
        FILTER ( Table2, Table2[Fecha cotizacion] = _NEARST_DATE )
    )

My Sample is as below.

Table1:

RicoZhou_1-1649752540599.png

Table2:

RicoZhou_0-1649752532777.png

Result is as below.

RicoZhou_2-1649752567607.png

 

Best Regards,
Rico Zhou

 

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

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.