Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi.
I have an issue I am currently unable to resolve, so any help would be greatly appreciated. I am trying to perform calculations across measures/date ranges and storing the result against a specific data/category value.
Using the table below as an example, I am trying to calculate the "Value" column. Basically multiple the values for Measure 1 & Measure 2 for a specific Year/Category (i.e. 2015, Cat 1) & subtract the corresponding values for Measure 1 * Measure 2 for Year/Category = 2014, Cat1. The table shows the values i need to use within the calculation.
Solved! Go to Solution.
Try this , If u don't want calculated column go with Measure
Value_1 =
var Cur_Category = CONCATENATEX(VALUES(Table4[Category]),Table4[Category],",")
var Measures_2014 = CALCULATE(SUM(Table4[Measure1]) * SUM(Table4[Measure2]),FILTER(ALL(Table4),AND(Table4[Year]=2014,Table4[Category]=Cur_Category)))
return
CALCULATE( SUM(Table4[Measure1]) * SUM(Table4[Measure2] )) - Measures_2014
It also give u the same result which i mention in previous post , but it is not column it is measure .
Try this , If u don't want calculated column go with Measure
Value_1 =
var Cur_Category = CONCATENATEX(VALUES(Table4[Category]),Table4[Category],",")
var Measures_2014 = CALCULATE(SUM(Table4[Measure1]) * SUM(Table4[Measure2]),FILTER(ALL(Table4),AND(Table4[Year]=2014,Table4[Category]=Cur_Category)))
return
CALCULATE( SUM(Table4[Measure1]) * SUM(Table4[Measure2] )) - Measures_2014
It also give u the same result which i mention in previous post , but it is not column it is measure .
is it possible to add a lookupvalue function in here? if the year is represented by a index number. can we add a lookupvalue function to lookup the index in another year table then put the lookuped value into the calculation?
Hi Baskar.
Thank you very much for resolving my issue, I really apreciate it...
Cool ,
For my assumption do u want multiple the measure1 and measure2 then subtract with 2014 Data ? am right ?
Create one Calculated Column like the image .
Try this, if it is not helping u let me know i will help u .
Hi @dax_bee,
This expectation could be achieve by calculated measure or calculated column:
Value (Calculated Measure) = CALCULATE( SUM(data[M1])*SUM(data[M2]),filter(data,data[Year]= MAX( data[Year]) )) - CALCULATE( SUM(data[M1])*SUM(data[M2]),filter(ALLEXCEPT(data,data[Category]),data[Year]=MAX(data[Year])-1 ))
(you could create seperate measure to understand each formula)
Value (Calcualted Column) = data[M1]*data[M2] - CALCULATE(sum(data[M1])*sum(data[M2]),filter(ALLEXCEPT(data,data[Category]),data[Year]=EARLIER(data[Year])-1 ))
Please check sample file and sample data for observation and choose one of 2 ways.
If this works for you please accept it as solution and also like to give KUDOS.
Best regards
Tri Nguyen
Hi Tri.
Thanks for responding to my post. I have looked at the solution and have the following queries, based upon my inital example;
1. M1 & M2 are both caluclated measures. Hence I am not able to select them within the Sum function, my understanding is that only "Columns" can be selected?
2. The value column for Year=2016 & Category=Cat 1 needs to subtract the value from 2014 Cat 1 (10 * 20) and not the value from 2015 Cat 1 which is what I think you have assumed in your solution (i.e. Year -1)?
If M1 and M2 is calculated measure , no need to add sum in front of M1and M2 . u can use as direct M1 and M2
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.