cancel
Showing results for 
Search instead for 
Did you mean: 

Generating Y/N attribute from date?

0 Kudos

Hello Community

I'd like to create a column on file import of a model, which checks if a date is in another column or not and gets filled with Y or N.

In pseudo code:

if date != empty:
    return "Y"
else:
    return "N"

Is this possible? I can't check the date column with if (isnull(), "N", "Y" ) and I need an easy switch for viewers of the story. Think about a column "Date of order finished" and I need to filter for finished and not finished orders with the push of a button.

Any idea on how to approach this? So far I'm enriching the data with a Python script - but that can't be the solution forever. We could use Python for the dashboard then.

Additional information: The data gets uploaded within a model. Maybe that's the wrong approach?

Thanks

Sebastian

former_member34
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you are new here, I recommend that you familiarize yourself with our Q&A Tutorial: https://developers.sap.com/tutorials/community-qa.html, as it provides tips for preparing questions that draw responses from our members. Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond: https://www.youtube.com/watch?v=46bt1juWUUM

Many thanks!

Accepted Solutions (1)

Accepted Solutions (1)

VijayetaSharma
Active Contributor

Hello tqbf,

You can use calculated dimensions in story or add it in model itself. Having it in story have some advantages.

In story > Create Calculated Dimension > add a "if" condition

Trick here is to use one of the available attributes of your date (automatic) hierarchy. In this example I used "year" and for empty date field "year" attribute appears as '0000'. If required, you can add similar logic at model level.

If you find shared info helpful, don't forget to accept (accept button at the bottom) and vote (voting arrows on left side)

Thanks,

Vijayeta

0 Kudos

vijayeta.sharma thank you, that works fine in my story. I did't knew about the .year option, it is very helpful!

Answers (0)