Forum Discussion

jsbi81's avatar
jsbi81
New Member
8 years ago
Solved

Create date Parameter (asat date) to get active customers

Hi,

 

I'm new to PowerBi. I have got the total count of customers and now trying to create a date Parameter to show active customers asat date. In SQL and Tableau I'm able to achieve this using the below where [Date] is my Parameter

 

[Start Date] <= [Date] AND IFNULL([End Date],[Date]) >= [Date]

 

How can I achive the same in PowerBI?

 

Thanks

Jag

  • jsbi81,

     

    You may refer to the following measure.

    Measure =
    VAR d =
        SELECTEDVALUE ( 'Calendar'[Date] )
    RETURN
        COUNTROWS (
            FILTER (
                Table1,
                Table1[Start Date] <= d
                    && (
                        ISBLANK ( Table1[End Date] )
                            || Table1[End Date] > d
                    )
            )
        )
    

2 Replies

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

    jsbi81,

     

    You may refer to the following measure.

    Measure =
    VAR d =
        SELECTEDVALUE ( 'Calendar'[Date] )
    RETURN
        COUNTROWS (
            FILTER (
                Table1,
                Table1[Start Date] <= d
                    && (
                        ISBLANK ( Table1[End Date] )
                            || Table1[End Date] > d
                    )
            )
        )
    
  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Without sample data, something like this should work:

     

    MyCount = CALCULATE(COUNTROWS(table),FILTER(table,[Start Date]<=[Date] && [End Date] >= [Date]))