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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

Last month reported 2020 vs 2019 parallel month

am working on a project to present my information and I need to have on two cards one with the last value of the current year 2020 that is being reported that they would come being 2274 and last year 1754 I am working with a calendar table and I have annexed the year 2019 and 2020 in the same table s i someone can help me with some simple measure would appreciate it.

Alexgamb20_0-1626457731781.png

2 ACCEPTED SOLUTIONS

Hi, @Alexgamb20 

 

There are two tables in your model, a calendar table and a fact table, right? I recreated the sample data, one calendar table and one sales table. Then once again completed the vision of the two cards, only need to change the fields of the formula I mentioned above. If your requirement is still that you need two cards, then my formula will work.


For the measure you mentioned, I'm not sure why it is, such as YTD, I would use something like this:
DATESYTD =CALCULATE ( SUM ( 'Global-Superstore'[Sales] ), DATESYTD ( 'Global-Superstore'[Order Date] ))
I can’t know what your data looks like. You can check my sample data. Below is my attachment. If my formula still does not work, then you can share your sample data without any sesentive information so that we may be able to easily get a solution.

 

sample data:

vangzhengmsft_1-1627525837212.png

 

my measure:

_CY = CALCULATE(SUM([Sale]),FILTER(ALL('Score'),EOMONTH('Score'[Date],0)=EOMONTH(MAX('Score'[Date]),0)))
_PY = CALCULATE(SUM([Sale]),FILTER(ALL('Score'),EOMONTH('Score'[Date],0)=EOMONTH(MAX('Score'[Date]),-12)))

my result:

vangzhengmsft_0-1627525661491.png

Please refer to the attachment below for details

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
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

v-angzheng-msft
Community Support
Community Support

Hi, @Alexgamb20 

 

This is a really useful tip.

1. To create a folder and group the measures

Enter the model tab and hold "Ctrl" to select the measure you want. then type the folder name in "Display folder" under properties.

vangzhengmsft_0-1627609546139.png

2. JANUARY->>JAN

You need to know the format function.

demo: https://dax.guide/format/

vangzhengmsft_1-1627609793899.png

my formula:

Month = FORMAT('Calendar'[Date],"MMM")
 
 

Best Regards,
Community Support Team _ Zeon Zheng
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

9 REPLIES 9
v-angzheng-msft
Community Support
Community Support

Hi, @Alexgamb20 

 

This is a really useful tip.

1. To create a folder and group the measures

Enter the model tab and hold "Ctrl" to select the measure you want. then type the folder name in "Display folder" under properties.

vangzhengmsft_0-1627609546139.png

2. JANUARY->>JAN

You need to know the format function.

demo: https://dax.guide/format/

vangzhengmsft_1-1627609793899.png

my formula:

Month = FORMAT('Calendar'[Date],"MMM")
 
 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

you are a capo my friend, you should be at NASA. Thanks a lot

v-angzheng-msft
Community Support
Community Support

Hi, @Syndicate_Admin 

 

try to create 2 measures like below:

current year = CALCULATE(SUM([Sales]),FILTER(ALL('Table'),EOMONTH([Date],0)=EOMONTH(MAX([Date]),0)))
Last year = CALCULATE(SUM([Sales]),FILTER(ALL('Table'),EOMONTH([Date],0)=EOMONTH(MAX([Date]),-12)))

Result:

vangzhengmsft_0-1626763972851.png

Please refer to the attachment below for details
(The sales values in my sample use a random function, so if you open my sample file you may not see the same summation values as I do.)

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I did it this way but it didn't work for me. although what I need is exactly the same... maybe ea xq I'm using a calendar table.

Hi, @Syndicate_Admin 

 

Not sure what your model looks like, could you please consdier sharing more details about it or a simple sample file without any sesentive information for further discussion? then I can try to look into it to come up with a more accurate measure.

 

Best Regards,
Community Support Team _ Zeon Zheng

Estoy usando una tabla calendario para el control de las fechas, la cual esta relacionada.

En la grafica hay 2 años que seria el año presente 2020 vs el año pasado 2019, lo que hice fue anexar las dos tablas en una sola, osea en una sola tabla esta el 2020 con 2019 la cual use la formula samperlastyear para que me salga en una sola grafica.

 

YTD = año a la fecha

PY: Año pasado

FY: Todo el año

 

La formula del 2020 es esta:

Volumen CY (YTD) = DIVIDE (SUM (ScorecardLATAM [Volumen]); 1000)
 
y la del 2019 es esta
Volumen PY (YTD) = CALCULATE ([Volumen PY (FY)]; FILTRO (VALORES (Calendario [Fecha]); [Volumen CY (YTD)]> 0))
 
Para obtener el Volumen PY
Volumen PY (FY) = CALCULATE ([Volumen CY (YTD)]; SAMEPERIODLASTYEAR (Calendario [Fecha]))
use la medida CY volumen xq es la misma tabla y descuento un año en especifico.

Hi, @Alexgamb20 

 

There are two tables in your model, a calendar table and a fact table, right? I recreated the sample data, one calendar table and one sales table. Then once again completed the vision of the two cards, only need to change the fields of the formula I mentioned above. If your requirement is still that you need two cards, then my formula will work.


For the measure you mentioned, I'm not sure why it is, such as YTD, I would use something like this:
DATESYTD =CALCULATE ( SUM ( 'Global-Superstore'[Sales] ), DATESYTD ( 'Global-Superstore'[Order Date] ))
I can’t know what your data looks like. You can check my sample data. Below is my attachment. If my formula still does not work, then you can share your sample data without any sesentive information so that we may be able to easily get a solution.

 

sample data:

vangzhengmsft_1-1627525837212.png

 

my measure:

_CY = CALCULATE(SUM([Sale]),FILTER(ALL('Score'),EOMONTH('Score'[Date],0)=EOMONTH(MAX('Score'[Date]),0)))
_PY = CALCULATE(SUM([Sale]),FILTER(ALL('Score'),EOMONTH('Score'[Date],0)=EOMONTH(MAX('Score'[Date]),-12)))

my result:

vangzhengmsft_0-1627525661491.png

Please refer to the attachment below for details

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Perfect served me.. but a question before closing the case.. how did you create a folder and group the measures? and another as I can change the dates to English currently appears to me as JANUARY I want to have them as JAN

Hi @Alexgamb20 ,

 

can you provide sample data?

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.