Visualization filter

  • Visualization filter

    Posted by Unknown Member on March 27, 2020 at 4:08 pm
    • Bijal Patel

      Member

      March 27, 2020 at 4:08 PM

      Based on the below data, I want the report to show:

      • FILTER 1: where the count of products > 1 for the regions Ā 
      • FILTER 2: also show product “DDD” (even though the count is 1 as it is just in 1 region)

      ProductID

      Name

      Region

      Sales

      AAA

      Product A

      US

      10,000

      BBB

      Product B

      CAN

      20,000

      BBB

      Product B

      US

      30,000

      CCC

      Product C

      US

      40,000

      DDD

      Product D

      EU

      15,000

      AAA

      product A

      EU

      10,000

      AAA

      Product A

      CAN

      10,000

      EEE

      Product E

      US

      10,000

      So the report should show:

      Products

      Count

      AAA

      3

      BBB

      2

      DDD

      1

      Ā 

      Also, the second filter can change from time to time, so would like the user to have the ability to include / exclude products as needed. For example: currently, they have included “DDD” but they might want to include “XYZ” later.

      I tried adding the count in the filter panel where COUNT is Greater than 1 . This works but does not show “DDD” .Ā 

      How can I achieve this kind of filtering?

      ——————————
      Bijal Patel
      ——————————

    • Lutz Bendlin

      Member

      March 27, 2020 at 4:26 PM

      In your measure definition you can use logic operators like “&&”Ā  (and)Ā  and “||”Ā  (or) to model these conditions.Ā  There’s also the OR() DAX function.

      ——————————
      Lutz
      ——————————
      ——————————————-

    • Bijal Patel

      Member

      March 27, 2020 at 7:20 PM

      Thanks Lutz! I am new to Power BI and I can’t get to code the below logic in a measure.Ā 

      Can you provide me with a sample measure for the below condition?Ā 

      If count(product) > 1
      Ā Ā  Ā  Ā  Ā  Ā display count
      Ā  Ā  else
      Ā  Ā  Ā  Ā  Ā  ifĀ  product = “DDD”Ā  Ā  Ā  Ā  Ā Ā 
      Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā displayĀ  countĀ 
      Ā  Ā  Ā  Ā  Ā  end if
      end if

      ——————————
      Bijal Patel
      ——————————
      ——————————————-

    • Lutz Bendlin

      Member

      March 27, 2020 at 11:50 PM

      As always there are many ways to do that.

      The option with logic operators:
      Var x = if(count(product)>1 || product =”DDD”,count,blank())

      If you don’t want to to write nested IF statements you can use the syntax sugar SWITCH():
      Var x = switch(true(),count(product)>1,count,product = “DDD”,count,blank())

      etc.

      ——————————
      Lutz
      ——————————
      ——————————————-

    • Bijal Patel

      Member

      March 28, 2020 at 11:53 AM

      Thank you so much Lutz!

      I was able to achieve what I wanted by:
      1) creating a measure to return the count of the products that I wanted to include (in this case “DDD”) – had to do this as I wasn’t able to reference the column in the IF condition in the measure directly. So couldn’t do:Ā product = “DDD”.Ā 
      2) Then created a measure with the IF condition : where count(product)> 1 || [Measure created in Step 1]

      May be you can combine both the measures but in my case had to keep them separate as I plan on using the first measure in other parts of report.

      thanks once again for your time and help!

      ——————————
      Bijal Patel
      ——————————
      ——————————————-

    Unknown Member replied 5 years, 5 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Visualization filter’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!