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
MEGHAMONTY
New Member

month calculation is skewed

Here is my table structure in the Model

 

MASTERA--> DETAILA

MASTERA-->DETAILB

 

Both DETAILA & DETAILB tables have data at the invidual date level.

MASTERA only has DETAILA Cust_Name & DETAILB Cust_Name

 

Here is my Matrix

MASTERA.Cust_Name as Rows

Value is CALCULATE(DIVIDE(DETAILA.COLUMN1,DETAILB.COLUMN2,0), DETAILA.DATE.MONTH, DETAILB.DATEMONTH)

For Columns I am using DATE.MONTH from DETAILA or DETAILB.

The result is taking either sum of the DETAILA.COLUMN1 or DETAILB.COLUMN1 depending on the date i use for columns.

I have tried connecting DETAILA,DETAILB using a calendar table and used month from calendar but again the results are skewed.

 

I technically want them to divide by month for MASTERA.Cust_Name

 

1 REPLY 1
AllisonKennedy
Super User
Super User

Are you able to provide some sample data or file?

You need to have a DimDate table which is connected to both Detail A and Detail B, use the DimDate.Month for your columns in the matrix. YOu are right to use MasterA.Cust_Name for Rows.

The measure will need updated as it can't divide one table by the other, so you'll need to add an aggregation in there, such as:

Value= DIVIDE(SUM(DETAILA.COLUMN1),SUM(DETAILB.COLUMN2),0)

You shouldn't need the date filter within the measure, as that will be provided by the context of the matrix.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.