Forum Discussion
Syndicate_Admin
Administrator
5 years agoHelp with calculated column
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 num...
- Anonymous5 years ago
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
Administrator
5 years agoExcellent, thank you very much friends, I worked perfectly.
They're the best 😃