Forum Discussion
DAX: Ranking Date
- 9 years ago
Hi stblonde,
I tried your first solution, but it showed up an Error (The column "date" cannot be found) :smileysad:You shouldn't leave the VAR Function (DAX) in your formula. The formula below is for your reference.:smileyhappy:
Rank = VAR d = Tableau1[Date] VAR c = Tableau1[Campaign ID] RETURN CALCULATE ( RANK.EQ ( d, Tableau1[Date], ASC ), FILTER ( ALL ( Tableau1 ), Tableau1[Campaign ID] = c ) )And the formula above should also meet your requirements:
Here is the sample pbix file for your reference.
Regards
Hi v-ljerr-msft,
First, thank you for your reply. My mistake, it's almost what I am looking for, but the Campaign ID can appear the same day with another one. I tried your first solution, but it showed up an Error (The column "date" cannot be found) :smileysad:
The idea is to get the ranking per campaign ID within period. For instance below, the Campaign 1 has been communicated 4 times (2, 4, 5 & 8 of december) so it will follow this sequence, but the Campaign 2 has been communicated to on the second of december as well like underneath:
Regards,
Steve
Hi stblonde,
I tried your first solution, but it showed up an Error (The column "date" cannot be found) :smileysad:
You shouldn't leave the VAR Function (DAX) in your formula. The formula below is for your reference.:smileyhappy:
Rank =
VAR d = Tableau1[Date]
VAR c = Tableau1[Campaign ID]
RETURN
CALCULATE (
RANK.EQ ( d, Tableau1[Date], ASC ),
FILTER ( ALL ( Tableau1 ), Tableau1[Campaign ID] = c )
)And the formula above should also meet your requirements:
Here is the sample pbix file for your reference.
Regards
- stblonde9 years agoRegular Visitor
Hi v-ljerr-msft,
Thank you ! It works pretty well on Power BI Desktop.
But I have another request how can it work directly within Excel Power Pivot interface ? Because the Var function doesn't seem to work outside of Power BI Desktop interface.
Thank a lot,
Steve
- v-ljerr-msft9 years agoMicrosoft Employee
Hi stblonde,
As I am not very familiar with Excel Power Pivot, I would suggest you also go to the Power Pivot Forum for better assistance on this issue. :smileyhappy:
Regards
- Gisselbrecht9 years agoRegular Visitor
Hello,
can you explain, how work your formula plz ? it work well for me but i don't understand how works the VAR value in CALCULATE function.
Thank you
- Anonymous8 years agoNot applicable
Rank =
Var Year = 'NDNQI Clinical Unit'[Year]
Var Qtr = 'NDNQI Clinical Unit'[Q Number]
Return
CALCULATE(
RANK.EQ(Year, 'NDNQI Clinical Unit'[Year]),
FILTER(ALL('NDNQI Clinical Unit'),'NDNQI Clinical Unit'[Q Number]=Qtr
))Not get Rank correctly
- Anonymous8 years agoNot applicable
Rank =
Var Year = 'NDNQI Clinical Unit'[Year]
Var Qtr = 'NDNQI Clinical Unit'[Q Number]
Return
CALCULATE(
RANK.EQ(Year, 'NDNQI Clinical Unit'[Year]),
FILTER(ALL('NDNQI Clinical Unit'),'NDNQI Clinical Unit'[Q Number]=Qtr
))Not get Rank correctly
- MarkyMark12 years agoAdvocate I
Hi how could I modify this to give a different rank when the dates are tied for the same campaign? I don't have access to the query editor to do a index for each row.