Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Data segmentation date as DAX formula

Greetings I have a problem with a table, the calculation of one of its columns depends on an arbitrary date, for example:

Column-if(date-"10-09-2020",1,0)

I need to analyze and graph this table by varying this arbitrary date, I had thought of a slicer but from what I understand it is NOT possible to get the dates that appear there for my formula, is there any other option?

  • Hi Anonymous ,

     

    We can create a date table to be the arbitrary date and create a measure to meet your requirement.

     

    1. Create a date table, then create a slicer using it.

     

    Date = CALENDARAUTO()

     

     

    2. Then we can create a measure to get the result.

     

    Column-if = 
    var _select = SELECTEDVALUE('Date'[Date])
    var _condition = IF(_select=MAX('Table'[Date]),1,0)
    return
    SUM('Table'[value]) * _condition
    

     

     

     

    If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

    It will be helpful if you can show us the exact expected result based on the tables.

     

    Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

     

    Best regards,

     

    Community Support Team _ zhenbw

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    BTW, pbix as attached.

2 Replies

  • Anonymous , Upu can not use slicer value in a column.

    You can try in column-like

     

    if([date] > date(2019,10,09),1,0)

     

    You can create a measure like

    if(max(Date[date]) > selectedvalue(Date[Date]),1,0)

     

    Please provide your feedback comments and advice for new videos
    Tutorial Series Dax Vs SQL Direct Query PBI Tips
    Appreciate your Kudos.

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    We can create a date table to be the arbitrary date and create a measure to meet your requirement.

     

    1. Create a date table, then create a slicer using it.

     

    Date = CALENDARAUTO()

     

     

    2. Then we can create a measure to get the result.

     

    Column-if = 
    var _select = SELECTEDVALUE('Date'[Date])
    var _condition = IF(_select=MAX('Table'[Date]),1,0)
    return
    SUM('Table'[value]) * _condition
    

     

     

     

    If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

    It will be helpful if you can show us the exact expected result based on the tables.

     

    Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

     

    Best regards,

     

    Community Support Team _ zhenbw

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    BTW, pbix as attached.