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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
colinryan
Regular Visitor

I have multiple columns of the same type of data in a Power BI dataset

Hello, 

 

I have 3 columns for genre data in a Power BI dataset and I want to create a chart that shows those columns as a single data point,

 

Screenshot 2024-07-18 032250.png

 

I want to count all three as a single data point in charts like this bar graph

 

Screenshot 2024-07-18 032530.png

 

how should I go about it?

 

Thank you!

3 REPLIES 3
v-yilong-msft
Community Support
Community Support

Hi @colinryan ,

I create a table as you mentioned.

vyilongmsft_0-1721280918036.png

Then I create a new table and here is the DAX code.

Table 2 = 
SUMMARIZE(
    FILTER(
        UNION(
            SELECTCOLUMNS('Table', "Number", 'Table'[Genre1]),
            SELECTCOLUMNS('Table', "Number", 'Table'[Genre2]),
            SELECTCOLUMNS('Table', "Number", 'Table'[Genre3])
        ),
        [Number] <> BLANK()
    ),
    [Number],
    "Frequency", COUNTROWS(FILTER(
        UNION(
            SELECTCOLUMNS('Table', "Number", 'Table'[Genre1]),
            SELECTCOLUMNS('Table', "Number", 'Table'[Genre2]),
            SELECTCOLUMNS('Table', "Number", 'Table'[Genre3])
        ),
        [Number] = EARLIER([Number]) && [Number] <> BLANK()
    ))
)

vyilongmsft_1-1721281409455.png

Finally you will get what you want.

vyilongmsft_2-1721281479606.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

danextian
Super User
Super User

Hi @colinryan ,

 

You need to transform your data so you only have one column for the three genre columns. In Power Query, select the title column, right click and then select unpivot other columns which will create two new columns - attribute and value. Rename them as desired. Create a measure to count the distinct titles ( use DISTINCTCOUNT function). Use the value column and newly created measure in your visual.

danextian_0-1721278173519.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Sorry I forgot to include, I also have a column for their respective gross profits. Won't unpivoting columns affect the totals of the gross profit column upon visualizing?

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors