Forum Discussion
Error in card with weeks
- 4 years ago
Hola Antonio_Gomez
You'll need to use a measure then to display the correct First and Last Values. See below. Hopefuly this solves it finally for you.
I've created two measures:Semana-Año Primero =VAR vUltima = MAX(Calendar_Months[calendar_dt])VAR vPrimero = MIN(Calendar_Months[calendar_dt])RETURN"Semana " & FORMAT(WEEKNUM(vPrimero),"0#") & "/" & YEAR(vPrimero)Semana-Año Ultima =VAR vUltima = MAX(Calendar_Months[calendar_dt])VAR vPrimero = MIN(Calendar_Months[calendar_dt])RETURN"Semana " & FORMAT(WEEKNUM(vUltima),"0#") & "/" & YEAR(vUltima)
Add a format to your query - and "D2" after the Number.ToText for Week:
= Table.AddColumn(#"Changed Type", "Semana-Año", each "Semana " & Number.ToText(Date.WeekOfYear([Found Date]),"D2") & "/" & Number.ToText(Date.Year([Found Date])))
That fixed it for me:
Refer to: Add Leading Zeros to a Number in Power BI Using Power Query - RADACAD
Hello Signore_Ands
I'm really glad you are helping me. Now, I understand the adding leading zeros, thanks.
I did it but only works for me if I switch Week/Year to Year/Week when the range is in differents year.
= Table.AddColumn(#"Changed Type1", "Semana-Año", each "Semana " & Number.ToText(Date.Year([Dia])) & "/" & Number.ToText(Date.WeekOfYear([Dia]),"D2"))
= Table.AddColumn(#"Changed Type1", "Semana-Año", each "Semana " & Number.ToText(Date.WeekOfYear([Dia]),"D2") & "/" & Number.ToText(Date.Year([Dia])) )
I think it's because the order is given only by the week number.
- Signore_Ands4 years ago
Advocate III
Hola Antonio_Gomez
You'll need to use a measure then to display the correct First and Last Values. See below. Hopefuly this solves it finally for you.
I've created two measures:Semana-Año Primero =VAR vUltima = MAX(Calendar_Months[calendar_dt])VAR vPrimero = MIN(Calendar_Months[calendar_dt])RETURN"Semana " & FORMAT(WEEKNUM(vPrimero),"0#") & "/" & YEAR(vPrimero)Semana-Año Ultima =VAR vUltima = MAX(Calendar_Months[calendar_dt])VAR vPrimero = MIN(Calendar_Months[calendar_dt])RETURN"Semana " & FORMAT(WEEKNUM(vUltima),"0#") & "/" & YEAR(vUltima)- Antonio_Gomez4 years ago
Resolver I
It works, you are the best!