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
Anonymous
Not applicable

DAX Measure

Hi,

 

I'm having some trouble coming up with a measure. I have a report that I refresh with new data at the beginning of each month. This new data contains changes to the old daata and new information for the previous month. IE. It's currently August 1st - so I'll replace the data with a new table that contains July data as well as changes to other months data. There will be no data relating to the current month I'm in.

 

I'm trying to set up a matrix to show the data as of June 31st compared to the data as of July 31st. The columns are the measures as follows: Data as of June 31st, Data as of July 31st, difference between the two, percent difference. 

 

To show the data as of June 31st I have a measure written as: 

Previous Month = CALCULATE ([Count of Units], DATEADD(DimDate[Date],-1,MONTH))
 
However, 
This measure gives me the same amount of units as my current month measure
 
Count of units= COUNTX(unitData,unitData[unitCount ]) which is just the total amount of units.
 
Am I interpreting this wrong and is there another DAX measure I should be using?
 
Thanks
3 REPLIES 3
Anonymous
Not applicable

I've been instead using this formula to calculate the prior months total units?
Previous Month Total = CALCULATE(
[Count of Units]
,FILTER(
ALL('DimDate'[Month_Nbr])
, DimDate[Month_Nbr] <= MAX(DimDate[Month_Nbr] ) - 1))
daxer-almighty
Solution Sage
Solution Sage

You have to have a relationship defined between the tables. It looks like currently you don't. Hence the filter under CALCULATE has no effect on the calculation.

Anonymous
Not applicable

All of the tables in this report are related. I am also using a Date Dimension table which is where the filter is pointing to. 

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