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
lakshay12311
Regular Visitor

Calculated measure excluding slicer

Hello all,

 

I have a scenario where I have 3 tables – 1 fact( named Actual) and 2 dimensions( Calendar and Account Dim). These are connected via Account ID and Date ID.

I have a required to create 2 measure :

  1. Total 3 months moving Avg for Account Cat= CALCULATE('Actual'[3Mnths Moving Avg],Account[Account Desc]="Cat")
  2. Value on Hand= DIVIDE(SUM('Actual'[Value]), Actual[Total 3 months moving Avg for Account Cat])

 

I want to get below table values. I am unable to get these. Can someone please suggest on what DAX needs to be changed?

 

 

Total 3 months moving Avg for Account Cat

Value

Value on Hand

Apple

1800

300

0.166666667

Boy

1800

400

0.222222222

Cat

1800

600

0.333333333

 

 

Sample data for Actual is :

 

Date ID

Account ID

Value

3Mnths Moving Avg

1

A

100

500

1

A

200

600

1

B

300

700

1

B

100

500

1

C

100

600

1

C

200

700

1

C

300

500

 

Sample data for Account Dim:

Account ID

Account Desc

A

Apple

B

Boy

C

Cat

 

 

 

Thanks,

Lakshay

 

1 REPLY 1
AnkitKukreja
Super User
Super User

Hi @lakshay12311 

Try something like this

 

CALCULATE ( AVERAGEX ( VALUES ( 'Date'[YearMonth] ), [Sales] ), DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -3, MONTH ) )

 

Thanks,

Ankit

If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.
Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

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.

Top Solution Authors