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

Productx Incorrect result using a measure

Hi there

 

I need to calculate a rolling return on a weighted average return (calculated in a measure). This is in theory 'working' but the results are a bit off, almost like the rounding isnt correct. 

 

I have applied the same formula to a column (Measure 3 below) and to the measure (with the same values - Measure 2). The productx of the the column is correct, the same formaula on the measure is not correct.

 

Measure 2 and 3 SHOULD be the same?

 

Measure 3 = CALCULATE(PRODUCTX(Performance1,Performance1[performance]),DATESINPERIOD(Performance1[dat],LASTDATE(Performance1[dat]),-(Allselected(NumberTable[Number],NumberTable[Number])),MONTH))
 
Measure 2 = CALCULATE(PRODUCTX(AllMeasures,[1 Perf W1]),DATESINPERIOD(Performance1[dat],LASTDATE(Performance1[dat]),-(Allselected(NumberTable[Number],NumberTable[Number])),MONTH))
 
MEASURE:
1 Perf W1 = (if(IF(ISFILTERED(Performance1[nam]),DISTINCTCOUNT(Performance1[nam]),IF(ISBLANK(SELECTEDVALUE(Performance1[nam])),0))= 1,SUM('Performance1'[Orig Performance]),0) * SUM('%F1W1'[Weight])+if(IF(ISFILTERED(Performance2[nam]),DISTINCTCOUNT(Performance2[nam]),IF(ISBLANK(SELECTEDVALUE(Performance2[nam])),0))= 1,SUM('Performance2'[Orig Performance]),0) * SUM('%F2W1'[Weight])+if(IF(ISFILTERED(Performance3[nam]),DISTINCTCOUNT(Performance3[nam]),IF(ISBLANK(SELECTEDVALUE(Performance3[nam])),0))= 1,SUM('Performance3'[Orig Performance]),0) * SUM('%F3W1'[Weight])+if(IF(ISFILTERED(Performance4[nam]),DISTINCTCOUNT(Performance4[nam]),IF(ISBLANK(SELECTEDVALUE(Performance4[nam])),0))= 1,SUM('Performance4'[Orig Performance]),0) * SUM('%F4W1'[Weight])+if(IF(ISFILTERED(Performance5[nam]),DISTINCTCOUNT(Performance5[nam]),IF(ISBLANK(SELECTEDVALUE(Performance5[nam])),0))= 1,SUM('Performance5'[Orig Performance]),0) * SUM('%F5W1'[Weight]))+1
 
COLUMN:
 
performance = Performance1[Orig Performance]+1
 
 
product issue.PNG

 

 

2 REPLIES 2
Greg_Deckler
Super User
Super User

Way too much going on there to understand what exactly is happening but the column and measure would not have to return the same results as the column has row context and no filter context while the measure has only filter context. So, going to depend on a whole array of possibilities. 

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks @Greg_Deckler , I might have been looking at this for too long and over explained!

 

I have simplified this and included the pbix. In short, the productx of a measure isn't generating the correct result when compared to excel, it is extreamely close which is why I think this could be a rounding issue.

 

https://www.dropbox.com/s/dciqrcsiu4eyvcu/fund%20analysis%20Sample.pbix?dl=0

https://www.dropbox.com/s/k4qejr511it9xnh/data6.csv?dl=0

 

Data.PNG

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.