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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Calculation in DAX measure returing all the rows.

Hi Everyone,

 

I created a measure using below query. Logic wise it is correct but the only thing I am facing right now is that It is returning all the rows from the table. What I observe is I am getting this output because in Var R1 and R2 I am doing some calculation. As you can see below i am adding 1 and also multiplying it with 10. This is applying to each row in the table. Can someone please let me know how should I write R1 and R2.

 

I also have a date slicer in the report page. where I am selecting only 1 date.

 

IndexBaseValue =
Var Mindate = CALCULATE(MIN(IndexFundNAV[Date]),ALL(IndexFundNAV[Date]))
Var Maxdate = CALCULATE(MAX(IndexFundNAV[Date]))
Var Currentdate = IF(Maxdate<Mindate,Mindate,Maxdate)
Var Diffdays = DATEDIFF(Mindate,Currentdate,DAY)
Var R1 = CALCULATE(10*(1+[RITD%]))
Var R2 = CALCULATE((10*(1+[RITD%]))^(Diffdays/365))

Var Result = if (Diffdays<365,R1,R2)

Return
Result

 

Example for desired output:

Date             IndexName IndexBaseValue

28-Sep-19     ABC             8.9

 

Currently getting:

Date             IndexName IndexBaseValue

28-Sep-19     ABC             10

28-Sep-19     ABC             10

28-Sep-19     ABC             10

28-Sep-19     ABC             8.9

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@Anonymous - A little difficult to tell what is going on, sample source data might help.

 

Check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, 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

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks @Greg_Deckler  for your reply. I will check the links which you have shared. However my issue got resolved. There was some table relatioship issue was there because of  that the measure not returing the correct answer. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.