Forum Discussion

jimpatel's avatar
jimpatel
Icon for Post Patron rankPost Patron
2 years ago
Solved

Count of total dates per day

Hi,   Thanks a lot for looking at my post.   I would like to do the below logic in power bi, Any idea will be much appreciated.   I have "Item","Date1" and "Date2" column and i would like to ge...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  jimpatel ,

     

    Here are the steps you can follow:

    1. Create calculated table – this column is the X-axis, which can contain all the de-emphasized data of Date1 and Date2.

    Table 2 =
    var _table=
    DISTINCT('Table'[Date1])
    var _table2=
    DISTINCT('Table'[Date2])
    var _table3=
    UNION(_table,_table2)
    return
    CALENDAR(
        MINX(_table3,[Date1]),MAXX(_table3,[Date1]))

    2. Create measure.

    Number of Date1 =
    COUNTX(
        FILTER(ALL('Table'),'Table'[Date1]=MAX('Table 2'[Date])),[Item])
    Number of Date2 =
     COUNTX(
        FILTER(ALL('Table'),
        'Table'[Date2]=MAX('Table 2'[Date])),[Item])

    3. Result:

     

     

    Best Regards,

    Liu Yang

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