Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Power BI Community, Cordial Greeting.
I'm around to ask you for a big help with a calculated column that I want to make.
I have 2 boards, 1. Semanas_Epidemiologica and 2. Report table, in table number 2 of reports I want to add a new column where I get according to the date of enrollment to which week corresponds from the table Semanas_Epidemiologica,as well:
| 1. Table of Semanas_Epidemiologica 
 
 
 | 2. Reporting table 
 
 
 | Expected result reporting table 
 
 
 | 
I hope I've put everything in place so they understand me and can help me.
Thank you very much in advance.
Walter
Solved! Go to Solution.
 
					
				
		
According to my understanding, you want to get the last [sem_Epi] fromtable1 when [Fecha_Inscripcion]is before [Fec_Fin_Sem], right?
As @Vera_33 suggest, you can use the MINX() and LOOKUPVALUE() functions to do this,
Sem_Epi =
VAR _date = [Fecha_Inscripcion]
VAR _near =
    MINX (
        FILTER (
            'Table of Semanas_Epidemiologica',
            'Table of Semanas_Epidemiologica'[Fec_Fin_Sem] >= _date
        ),
        [Fec_Fin_Sem]
    )
RETURN
    LOOKUPVALUE ( 'Table of Semanas_Epidemiologica'[Sem_Epi], [Fec_Fin_Sem], _near )
Or to make it easier to understand, use the following formula:
Sem_Epi 2 =
VAR _date = [Fecha_Inscripcion]
VAR _near =
    CALCULATE (
        MIN ( 'Table of Semanas_Epidemiologica'[Fec_Fin_Sem] ),
        FILTER (
            'Table of Semanas_Epidemiologica',
            'Table of Semanas_Epidemiologica'[Fec_Fin_Sem] >= _date
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table of Semanas_Epidemiologica'[Sem_Epi] ),
        FILTER (
            'Table of Semanas_Epidemiologica',
            'Table of Semanas_Epidemiologica'[Fec_Fin_Sem] = _near
        )
    )
The final output is shown below:
You could take a look at the pbix file here.
Best regards
Eyelyn Qin
If this post helps, then consider Accept it as the solution to help other members find it faster.
@Syndicate_Admin you should mark the correct post as a solution so that others can take advantage of it rather than marking your own reply as a solution. Just advice.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Excellent, thank you very much friends, I worked perfectly.
They're the best 😃
 
					
				
		
According to my understanding, you want to get the last [sem_Epi] fromtable1 when [Fecha_Inscripcion]is before [Fec_Fin_Sem], right?
As @Vera_33 suggest, you can use the MINX() and LOOKUPVALUE() functions to do this,
Sem_Epi =
VAR _date = [Fecha_Inscripcion]
VAR _near =
    MINX (
        FILTER (
            'Table of Semanas_Epidemiologica',
            'Table of Semanas_Epidemiologica'[Fec_Fin_Sem] >= _date
        ),
        [Fec_Fin_Sem]
    )
RETURN
    LOOKUPVALUE ( 'Table of Semanas_Epidemiologica'[Sem_Epi], [Fec_Fin_Sem], _near )
Or to make it easier to understand, use the following formula:
Sem_Epi 2 =
VAR _date = [Fecha_Inscripcion]
VAR _near =
    CALCULATE (
        MIN ( 'Table of Semanas_Epidemiologica'[Fec_Fin_Sem] ),
        FILTER (
            'Table of Semanas_Epidemiologica',
            'Table of Semanas_Epidemiologica'[Fec_Fin_Sem] >= _date
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table of Semanas_Epidemiologica'[Sem_Epi] ),
        FILTER (
            'Table of Semanas_Epidemiologica',
            'Table of Semanas_Epidemiologica'[Fec_Fin_Sem] = _near
        )
    )
The final output is shown below:
You could take a look at the pbix file here.
Best regards
Eyelyn Qin
If this post helps, then consider Accept it as the solution to help other members find it faster.
Hi @Syndicate_Admin @WolterNet
You don't have duplicated weeks in Table1, right?
Cal Column =
@Syndicate_Admin use the following DAX expression to add a column:
Sem_Epi = 
VAR _t = 
CALCULATETABLE ( 
    Seman,
    FILTER ( 
        Seman, 
        Seman[Fec_Fin_Sem]  >= Reporting[Fecha_Inscripcion]
   ) 
) 
VAR _d = 
CALCULATE ( 
    MIN ( Seman[Sem_Epi] ),
    TOPN ( 1, _t, [Fec_Fin_Sem], ASC )
)
RETURN _d 
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 84 | |
| 49 | |
| 36 | |
| 31 | |
| 30 |