Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Fátima
Helper II
Helper II

Bars chart without repeated data

Hi!

 

I am trying to create a bar chart without some repeated data. Imagine we have a table similar to this:

TABLE1

TEST_ID            CATEGORY          SUBCATEGORY          CHECKED

123                   CAT1                   SUBCAT1.1                 TRUE

123                   CAT1                   SUBCAT1.2                 FALSE

123                   CAT1                   SUBCAT1.3                 TRUE

124                   CAT1                   SUBCAT1.1                 TRUE

124                   CAT2                   SUBCAT2.1                 FALSE

124                   CAT2                   SUBCAT2.2                 TRUE

124                   CAT1                   SUBCAT1.3                 TRUE

125                   CAT2                   SUBCAT2.1                 TRUE

125                   CAT3                   SUBCAT3.1                 TRUE

125                   CAT3                   SUBCAT3.2                 TRUE

125                   CAT4                   SUBCAT4.1                 FALSE

 

Can I make a bar chart to show how many times have a category been checked, counting just one per test ID and ignoring de subcategories? In the example above, the result should be:

CAT1 ------ 3 (Something under CAT1 has been checked by 3 test IDs)

CAT2 ------ 1

CAT3 ------ 1

CAT4 ------ 0

 

Thanks in advance!

 

Regards!

1 ACCEPTED SOLUTION
Rambo92
Helper I
Helper I

Hi,

I think the desired output you have shown above is wrong i believe. There are only 2 distinct TESTID's for CAT1 and 2 for CAT2. In that case, it will show bar chart something like below.

 

Rambo92_0-1674491762005.png

If this is what required, To get only the unique test ids selected for categories.  Keep TESTID as below and select distinct count.

Rambo92_1-1674491940426.png

Hope this one works.

View solution in original post

2 REPLIES 2
Rambo92
Helper I
Helper I

Hi,

I think the desired output you have shown above is wrong i believe. There are only 2 distinct TESTID's for CAT1 and 2 for CAT2. In that case, it will show bar chart something like below.

 

Rambo92_0-1674491762005.png

If this is what required, To get only the unique test ids selected for categories.  Keep TESTID as below and select distinct count.

Rambo92_1-1674491940426.png

Hope this one works.

Hi @Rambo92 !

 

You are absolutely right, the desired output wasn't correct, and your answer is exactly what I needed. Thank you so much!

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.