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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
migfar
New Member

Mostrar Año seleccionado y año anterior en el mismo gráfico

migfar_0-1716223810726.png

Si selecciono en el segmentador de datos el año actual y el anterior simultaneamente me muestra este gráfico, los 2 años juntos, eso es lo que quiero, pero mi idea es seleccionar solo el 2024 y que me muestre el 2024 y el año anterior de la misma manera. 

1 ACCEPTED SOLUTION

Hi,@migfar 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1716276600109.png

2.Generate a table containing only the year:

 

year Table = DISTINCT(SELECTCOLUMNS('SALE',"year",YEAR('SALE'[MOUTH])))

 

3. Below are the measure I've created for your needs:

 

Measure = 
VAR select1=SELECTEDVALUE('year Table'[year])
RETURN CALCULATE(SUM('SALE'[VALUE]),FILTER(SALE,'SALE'[MOUTH].[Year]=select1||'SALE'[MOUTH].[Year]=select1-1))

4.Replaces the values in the visualization section with measure values:

vlinyulumsft_0-1716276748017.png

5.Here's my final result, which I hope meets your requirements.

vlinyulumsft_1-1716276763709.png

vlinyulumsft_3-1716276782974.png

Best Regards,

Leroy Lu

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

2 REPLIES 2
migfar
New Member

Si selecciono solo 2024 me sale así, y yo necesito el año anteior en el mismo gráfico.. 

migfar_0-1716224294336.png

 

Hi,@migfar 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1716276600109.png

2.Generate a table containing only the year:

 

year Table = DISTINCT(SELECTCOLUMNS('SALE',"year",YEAR('SALE'[MOUTH])))

 

3. Below are the measure I've created for your needs:

 

Measure = 
VAR select1=SELECTEDVALUE('year Table'[year])
RETURN CALCULATE(SUM('SALE'[VALUE]),FILTER(SALE,'SALE'[MOUTH].[Year]=select1||'SALE'[MOUTH].[Year]=select1-1))

4.Replaces the values in the visualization section with measure values:

vlinyulumsft_0-1716276748017.png

5.Here's my final result, which I hope meets your requirements.

vlinyulumsft_1-1716276763709.png

vlinyulumsft_3-1716276782974.png

Best Regards,

Leroy Lu

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

 

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors