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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
banjofork
Regular Visitor

Wrong totals after unpivoting

Hello BI gods,

 

I am currently working on an allocation report. I had to unpivot 4 colums into one and now i'm stuck with some wrong totals.

 

My goal is to calculate the number of categories by tasks (the ratio between task to category is 1 to 1, meaning there can be no more than 1 category in a task and vice versa), distinctcount doesn't work because unlike tasks, the list of categories is around 10 and tasks are around 100+ and after unpivoting there are a lot of duplicates.

 

To vizualize my problem. I want to know how many categories

Task                                   category

PotatoOrange
PotatoOrange
PotatoOrange
PotatoOrange
TomatoGreen
TomatoGreen
TomatoGreen
StrawberryRed
CoconutOrange
CoconutOrange
CoconutOrange
CoconutOrange
Appleblack
Appleblack
Appleblack
Appleblack

 

The results i'm looking for is: 2 orange, 1 green, 1 red, 1 blue, 1 blacketc.

P.S. HELP 

 

5 REPLIES 5
v-yuaj-msft
Community Support
Community Support

Hi @banjofork ,

 

Sorry for that the information you have provided is not making the problem clear to me.

Can you share some sample data and the expected result to have a clear understanding of your question?

You can save your files in OneDrive, Google Drive, or any other cloud sharing platforms and share the link here.

 

Best Ragards,

Yuna

banjofork
Regular Visitor

2211

 

Righto, what i basically want is that my pie chart shows the correct amount of categories fx. 

 

If the selected person has 3 tasks there should be only 3 categories ( 1 to 1 ratio for title and category). Currently it counts the number based on how many times a title is being iterated...

 

EDIT: For some weird reason it looks like the categoryid and category.title mismatch on some entries, but that is not the case, i simply did too many edits of the screenshot.

ryan_mayu
Super User
Super User

@banjofork 

have you tried split the column to two and create a measure?

Measure = CALCULATE(DISTINCTCOUNT('Table'[Task]),ALLEXCEPT('Table','Table'[category]))

1.PNG





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

Proud to be a Super User!




I've created an id table for the categories, but your suggestion did not work for me. What I'm trying to do is visualize in a pie chart the ratio of categories from the total of tasks.

 

@banjofork 

Could you please share the sample data and output in excel? screenshot is also fine.





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

Proud to be a Super User!




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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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