cancel
Showing results for 
Search instead for 
Did you mean: 

Using Rankdesc to create a custom Column

Flo_Rod
8 - Cloud Apps
8 - Cloud Apps

Hi, 
I am a sisense newbie. I am trying to create a custom column in the data model to rank latest week and other weeks from latest to oldest. I am using a live model connected to a snowflake database.  The data is such that once a week its refreshed and customer purchases for the range of that week are entered against a single day. Whenever I try to save this formula, I am getting an error. Can someone help me fix this formula please.

Formula: RANKDESC("purchase date")
Error: Parsing failed: SQL compilation error: Unknown function RANKDESC
2 ACCEPTED SOLUTIONS

DRay
Community Team Member
Community Team Member

Hi @Flo_Rod,

Thank you. Queries against a Live Data Source use the data source syntax, not the Sisense syntax. Here is the Snowflake documentation for RANK. Can you take a look at that and let us know if it helps?

Thank you.

David Raynor (DRay)

View solution in original post

Flo_Rod
8 - Cloud Apps
8 - Cloud Apps

Thank you @DRay I ended up changing the SQL query  in the data model. The function I used was:
DENSE_RANK() OVER (ORDER BY PURCHASE_DATE DESC) AS CC_PURCHASE_DATE_RANK
 This created the custom column I required.

View solution in original post

4 REPLIES 4

DRay
Community Team Member
Community Team Member

Hi @Flo_Rod.

Can you tell us what the error message says? That should help us figure out what the issue is.

 

David Raynor (DRay)

Flo_Rod
8 - Cloud Apps
8 - Cloud Apps
Formula: RANKDESC("purchase date")
Error: Parsing failed: SQL compilation error: Unknown function RANKDESC

DRay
Community Team Member
Community Team Member

Hi @Flo_Rod,

Thank you. Queries against a Live Data Source use the data source syntax, not the Sisense syntax. Here is the Snowflake documentation for RANK. Can you take a look at that and let us know if it helps?

Thank you.

David Raynor (DRay)

Flo_Rod
8 - Cloud Apps
8 - Cloud Apps

Thank you @DRay I ended up changing the SQL query  in the data model. The function I used was:
DENSE_RANK() OVER (ORDER BY PURCHASE_DATE DESC) AS CC_PURCHASE_DATE_RANK
 This created the custom column I required.