cancel
Showing results 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.

Helper V

## Comparing months with the same selected period

Hi people,

I'm having a little trouble getting the following result: I'd like to get the amount of leads for the current month, the previous month and the month before the previous one according to the period I select. I want to know what was the amount in the same period in these 3 months. How could I do this?
Here is the result I would like to get,

I am using the following measure and it is not working

``````    var atual = CALCULATE(DISTINCTCOUNT(_leads[Id]),_leads[Produtos com nome do Reaal]<>BLANK())
var delta = DATEDIFF(max(d_calendario[Date]), min(d_calendario[Date]), MONTH)

RETURN
CALCULATE(
atual,
)
``````

Here is my PBIX attached:

https://ufile.io/nl9o9xon

1 ACCEPTED SOLUTION
Community Champion

Hi

DATEADD is meant to give the result in the selected date slicer. use these 3 dax

Atual -1 = CALCULATE([atual] , DATEADD(d_calendario[Date] , -1 , MONTH))
Atual -2 = CALCULATE([atual] , DATEADD(d_calendario[Date] , -2 , MONTH))

Regards
Amine Jerbi

and you can follow me on

5 REPLIES 5
Community Champion

Hi @kasife

Is this what you want to see?

Regards
Amine Jerbi

and you can follow me on

Helper V

@aj1973 thank you so muck for help.

Id like to see this:

I'm going to select periods, for example, from the 15th to the 20th of July, so I'll have the result from the 15th to the 20th of June and May as well.

Instead of using the calendar month, I would like to use dates

Community Champion

Hi

DATEADD is meant to give the result in the selected date slicer. use these 3 dax

Atual -1 = CALCULATE([atual] , DATEADD(d_calendario[Date] , -1 , MONTH))
Atual -2 = CALCULATE([atual] , DATEADD(d_calendario[Date] , -2 , MONTH))

Regards
Amine Jerbi

and you can follow me on

Helper V

@aj1973 thank you so much. Its working.

Community Champion

Welcome

Regards
Amine Jerbi

and you can follow me on

Announcements

#### 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

#### Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

#### Power BI Monthly Update - March 2024

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

Top Solution Authors
Top Kudoed Authors