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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

 










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


Proud to be a Super User!









"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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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