Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Earlier Function : How does it work

$
0
0

Dear POWER BI Experts ,

I have the below  Test Data :

 

CREATE TABLE Dax_Test_Product ( ProductID INT , UnitPrice INT )

 

INSERT INTO Dax_Test_Product VALUES ( 1 , 10)
INSERT INTO Dax_Test_Product VALUES ( 2 , 20)
INSERT INTO Dax_Test_Product VALUES ( 3 , 30)
INSERT INTO Dax_Test_Product VALUES ( 4 , 50)
INSERT INTO Dax_Test_Product VALUES ( 5 , 60)
INSERT INTO Dax_Test_Product VALUES ( 6 , 70)
INSERT INTO Dax_Test_Product VALUES ( 7 , 100)
INSERT INTO Dax_Test_Product VALUES ( 8 , 110)
INSERT INTO Dax_Test_Product VALUES ( 9 , 130)
INSERT INTO Dax_Test_Product VALUES ( 10 , 150)
INSERT INTO Dax_Test_Product VALUES ( 11 , 200)
INSERT INTO Dax_Test_Product VALUES ( 12 , 230)
INSERT INTO Dax_Test_Product VALUES ( 13 , 240)
INSERT INTO Dax_Test_Product VALUES ( 14 , 250)
INSERT INTO Dax_Test_Product VALUES ( 15 , 270)
INSERT INTO Dax_Test_Product VALUES ( 16 , 300)

 

The question - 
Now If we want to Rank the products we can use the below formula -
Column_Rank = COUNTROWS(Filter(Dax_Test_Product,Dax_Test_Product[UnitPrice]<Earlier(Dax_Test_Product[UnitPrice])) ) +1

 

Now here , since I am using this in the calculated colums it is creating a new row context and then the filter also creates one another new row context , Could you please let me know how the row context created by the Filter actually takes place here?

 

I would also like to know about the context switches , how it happens .

 

Thanks in advance ,

Abhisek


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>