March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi!
I've been trying to do what said in this post http://community.powerbi.com/t5/Community-Blog/DAX-as-a-Language/ba-p/22120 with my own data, the problem is that I did all process and I have the correlation but I need that if I do some filter the correlation has to be re calculate, it's because for example I need to find the correlation in different cities. So I changed your code:
//First X CorrelateX3 = VAR AverageX3= AVERAGEX(ALLSELECTED('Llamadas Une'),[Valor]) RETURN ([Valor]-AverageX3) //Then Y CorrelateY3 = VAR AverageY3 = AVERAGEX(ALLSELECTED('TRPS Une Hogares'),[Trps P Mas 25 MA]) RETURN ([Trps P Mas 25 MA]- AverageY3) //Finally the corelation Correlation2 = VAR SumCorrelateX3SumCorrelateX3= SUMX(ALLSELECTED('Llamadas Une'),[CorrelateX3]*[CorrelateX3]) VAR SumCorrelateX3SumCorrelateY3= SUMX(ALLSELECTED('Llamadas Une'),[CorrelateX3]*RELATED('TRPS Une Hogares'[CorrelateY3])) VAR SumCorrelateY3CorrelateY3= SUMX(ALLSELECTED('Llamadas Une'),RELATED('TRPS Une Hogares'[CorrelateY3])*RELATED('TRPS Une Hogares'[CorrelateY3])) RETURN ( SumCorrelateX3SumCorrelateY3 / SQRT(SumCorrelateX3SumCorrelateX3*SumCorrelateY3CorrelateY3))
I calculated the x average to testing:
//no filter AverageX = AVERAGEX(ALL('Llamadas Une'),[Valor]) //Filter, it is like AverageX3 Average lla = AVERAGEX(ALLSELECTED('Llamadas Une'),[Valor])
I found that the error is because the subtraction between [Valor]-AverageX3 it's not ok:
As you can see here, the result in CorrelateX3 is equal to subtract Valor-AverageX and not Valor-AverageX3. I don't know why it's happend here, Colud you Help me with this issue? or do you have other idea to do a dinamic correlation?
Thanks
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |