Forum Discussion

Testsubjec's avatar
Testsubjec
Regular Visitor
5 years ago
Solved

Filter Values for a Line Chart

Hi,

I'm new to Power BI, so apologies if this is a really simple question to answer. 

I've created a Line Chart to display number of API Requests by Year / Month.

I'd like to add another series to the chart to show number of failed requests but I'm struggling to understand how to do this. I have a HttpStatusCode field, in short count the number of Id's whereby the HttpStatusCode <> 200.

Again, apologies if this sounds very simple.

 

  • Hey Testsubjec ,

     

    you can do that with a measure.

    Try the following:

    Status not 200 = CALCULATE( SUM(myTable[API Requests]), mytable[HttpStatusCode] <> 200)

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     

2 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey Testsubjec ,

     

    you can do that with a measure.

    Try the following:

    Status not 200 = CALCULATE( SUM(myTable[API Requests]), mytable[HttpStatusCode] <> 200)

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi Testsubjec ,

    Just as selimovd said ,try  the below:

    Status not 200 = CALCULATE( SUM(myTable[API Requests]), mytable[HttpStatusCode] <> 200)

    Or (if API Requests is Access log)

    Status not 200 = CALCULATE( distinctcount(myTable[API Requests]), mytable[HttpStatusCode] <> 200)
    If your problem  has been solved, if so, please consider Accept a correct reply as the solution to help others find it.

    If still not work ,could you pls share your pbix file,remember to remove confident data.

     

    Best Regards

    Lucien