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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Saniat
Helper V
Helper V

Go one month extra than selected date slicer

Hi,

I am trying to calculate a measure (measure 3 in picture), which is derived from measure 1 and 2.

 

As you can see to calculate B, we always take one extra month of data from the previous month of measure 2.

 

In the pic below the user has selected dates: March, April and May.

To calculate A, we take data for these three months but for B, we take data for one extra month.

I divide A by B to get measure 3.

Saniat_0-1655934451425.png

 




Is there any way to achieve this ?

Thanks

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Ensure you have a Calendar Table with a relationship (Many to One and Single) to your Data Table.  Write calculated column formulas to extract Year, Month name and Month number.  Sort the Month name by the Month number.  To your slicer, drag Month name from the Calendar table and select 3 months.  Write these measures:

Total = sum(Data[Amount])

Total including additional prior month = calculate([Total],datesbetween(Calendar[Date],edate(min(calendar[date]),-1),max(calendar[date])))

Ratio = divide([Total],[Total including additional prior month])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

Ensure you have a Calendar Table with a relationship (Many to One and Single) to your Data Table.  Write calculated column formulas to extract Year, Month name and Month number.  Sort the Month name by the Month number.  To your slicer, drag Month name from the Calendar table and select 3 months.  Write these measures:

Total = sum(Data[Amount])

Total including additional prior month = calculate([Total],datesbetween(Calendar[Date],edate(min(calendar[date]),-1),max(calendar[date])))

Ratio = divide([Total],[Total including additional prior month])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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