Forum Discussion

blissgrn's avatar
blissgrn
New Member
3 years ago

Filter charts with measure

Hi,


I have this measure that filters data according to a range (columns: startdate, enddate).


Range =
var StartRange = FIRSTDATE('Data Table'[Date])
var EndRange = LASTDATE('Data Table'[Date])
var StartDate = SELECTEDVALUE(Pyramid[startdate])
var EndDate = SELECTEDVALUE(Pyramid[enddate])
return if ((EndDate <> BLANK() && ((StartDate <= StartRange && EndDate >= StartRange) || (StartDate >= StartRange && StartDate <= EndRange))) || (EndDate == BLANK() && StartDate <= EndRange), 1,0)

Then I created two charts filtered by this measure.


The first one :

 

 

The second one :

 

 

The only difference between both charts is that I added the startdate and the enddate in the Y axe.


Now both charts displays different results. The first one is the correct one :

 

 

I don't understand why the second one does not display the same data, as the only filter should be the range.

Without specifying explicitly the startdate and enddate, the data is not correct, which causes me some issues with charts that only allow one entry.


Could someone explain this to me?

What could I do to make the second chart work without specifying the startdate and enddate?

 

Here the pbix: File 


Thank you!

 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi blissgrn ,

    In your first chart, you’re using [startdate] and [enddate] as part of your Y-axis, which means each row in your data is considered unique based on the combination of [startdate],[enddate],[interval],and [sex]. This results in a more detailed view of your data.

    In the second chart, you’ve removed [startdate] and [enddate] from your Y-axis. This means that rows with the same and are considered identical and their values are aggregated together. This results in a less detailed, more summarized view of your data.


    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum