Forum Discussion

Segun's avatar
Segun
Frequent Visitor
8 years ago
Solved

Dynamic date input

Hello ,

 

I need help in furing out how to write a Dax for dynamic date input.

As shown in the table below, I would like to select my input date column usind a slicer

E.g 

Date of Birth

Wedding Date

Divorce Date

 

And then use the specific date data to build my visualization. The user can then be able to select which of thses dates they want to plot.

 

Thanks,

  • Hi Segun 

    Based on my understanding:

    First, you would like to select from three date columns using a slicer,

    Second, users can select from some dates of one column to plot a visual.

     

    For example, I use the following dataset as a test.

     

    First, from “Sheet1”, create three new tables

    Table1 =
    SUMMARIZE ( Sheet1, [Date of Birth], [numnber], [value] )
    Table2 =
    SUMMARIZE ( Sheet1, [Wedding Date], [numnber], [value] )
    Table 3 =
    SUMMARIZE ( Sheet1, [Divorce Date], [numnber], [value] )

     

    Second, create “Date Type” columns in three tables separately.

    In Table1

    Date Type =
    IF ( [Date of Birth] <> BLANK (), "Date of Birth" )

    In Table2

    Date Type =
    IF ( [Wedding Date] <> BLANK (), "Wedding Date" )

     

    In Table3
    Date Type =
    IF ( [Divorce Date] <> BLANK (), "Divorce Date" )

     

    Third, union three new tables and rename column name as you wanted.

    Table 4 =
    UNION ( 'Table1', Table2, 'Table 3' )

     

    Finally, in Report View, we could add columns “Date Type” and “Date” to slicers.

     

    Best Regards

    Maggie

3 Replies

  • Segun's avatar
    Segun
    Frequent Visitor

    I'm trying to create a chart with dynamic date input. 

    The user would be able to select a date category with a slicer option and the visualization will automatically be populated

    The input dates category look like something in the picture below. Thanks for your help.

  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi Segun 

    Based on my understanding:

    First, you would like to select from three date columns using a slicer,

    Second, users can select from some dates of one column to plot a visual.

     

    For example, I use the following dataset as a test.

     

    First, from “Sheet1”, create three new tables

    Table1 =
    SUMMARIZE ( Sheet1, [Date of Birth], [numnber], [value] )
    Table2 =
    SUMMARIZE ( Sheet1, [Wedding Date], [numnber], [value] )
    Table 3 =
    SUMMARIZE ( Sheet1, [Divorce Date], [numnber], [value] )

     

    Second, create “Date Type” columns in three tables separately.

    In Table1

    Date Type =
    IF ( [Date of Birth] <> BLANK (), "Date of Birth" )

    In Table2

    Date Type =
    IF ( [Wedding Date] <> BLANK (), "Wedding Date" )

     

    In Table3
    Date Type =
    IF ( [Divorce Date] <> BLANK (), "Divorce Date" )

     

    Third, union three new tables and rename column name as you wanted.

    Table 4 =
    UNION ( 'Table1', Table2, 'Table 3' )

     

    Finally, in Report View, we could add columns “Date Type” and “Date” to slicers.

     

    Best Regards

    Maggie

    • Segun's avatar
      Segun
      Frequent Visitor

      Thank you! I really appreciate!