Forum Discussion
RANKx
- 3 years ago
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Rank measure: = IF ( HASONEVALUE ( Data[CustomerID] ) && HASONEVALUE ( Data[ProductID] ), CALCULATE ( COUNTROWS ( SUMMARIZE ( Data, Data[CustomerID], Data[ProductID], Data[Date Purchased] ) ), WINDOW ( 1, ABS, 0, REL, SUMMARIZE ( ALL ( Data ), Data[CustomerID], Data[ProductID], Data[Date Purchased] ), ORDERBY ( Data[Date Purchased], DESC ), KEEP, PARTITIONBY ( Data[CustomerID], Data[ProductID] ) ) ) )
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Rank measure: =
IF (
HASONEVALUE ( Data[CustomerID] ) && HASONEVALUE ( Data[ProductID] ),
CALCULATE (
COUNTROWS (
SUMMARIZE ( Data, Data[CustomerID], Data[ProductID], Data[Date Purchased] )
),
WINDOW (
1,
ABS,
0,
REL,
SUMMARIZE (
ALL ( Data ),
Data[CustomerID],
Data[ProductID],
Data[Date Purchased]
),
ORDERBY ( Data[Date Purchased], DESC ),
KEEP,
PARTITIONBY ( Data[CustomerID], Data[ProductID] )
)
)
)
Thank you Jihwan_Kim . This works wonderfuly and is exactly what I am looking for. However, it does not seem to work with Direct Query connection. Is that a limitation ? is there an alternative way to calcuate this using Direct Query/ Live connection mode ?
- Jihwan_Kim3 years agoSuper User
Hi,
I am not sure how your datamodel looks like, but I think you can try using other than SUMMARIZE function in the measure.
- memoalkatib13 years agoFrequent Visitor
The "Window" built in function is not supported with live connection/ direct query. I tried subsituting the window function with summerize and other built in functions, but not geting the right ouput. Are you able to shed some insights to how that can be done ? I would highly appreciate it.