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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RLSid17
Helper III
Helper III

Percentage of Grand Total from multiple datasets

Hi,

Would it be possible to count the values of 1 column from multiple datasets (currently 9 datasets)?

I'm currently creating a report for survey responses and each dataset/category has a column "Grouped Response" so it would count how many are unfavorable, neutral, and favorable and get the percentage of it.

So I managed to get the percentage from 1 dataset (see below sample) but I was tasked to get the percentage of all the categories. 

RLSid17_0-1666856567932.png


I'm still a novice in Power BI and learning as I go. Any response or solution is much appreciated! Let me know if there are more details needed from me.

1 ACCEPTED SOLUTION

Hi @RLSid17 ,

 

If your datasets have different columns, please try:

 

NewTable2 = UNION(
    SELECTCOLUMNS('Table1',"Employee Favorability",'Table1'[Employee Favorability]),
    SELECTCOLUMNS('Table2',"Employee Favorability",'Table2'[Employee Favorability])
    )

 

vyadongfmsft_0-1666943146344.png

 

 

 

Please refer the attached pbix file.

 

Best regards,

Yadong Fang

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

View solution in original post

9 REPLIES 9
v-yadongf-msft
Community Support
Community Support

Hi @RLSid17 ,

 

Did you mean this?

vyadongfmsft_0-1666949852706.png

Best regards,

Yadong Fang

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

Hi @v-yadongf-msft 

No, it is not the visualization of it. So basically whatever that was selected in the slicer per table as seen below would automatically calculate the visual:

RLSid17_0-1666950789056.png

Just wondering if it is possible. Then if not I will just use the slicer for the UNIONed table. 🙂



Hi @RLSid17 ,

 

I think it is possible. When you use the slicer, the table will be filtered by the slicer and calculate automatically. You can try it.

 

Best regards,

Yadong Fang

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

v-yadongf-msft
Community Support
Community Support

Hi @RLSid17 ,

 

I have added week number column to my test tables like below:

vyadongfmsft_0-1666947168646.png

 

Please try:

NewTable2 = UNION(
    SELECTCOLUMNS('Table1',"Employee Favorability",'Table1'[Employee Favorability],"Week number",'Table1'[Week number]),
    SELECTCOLUMNS('Table2',"Employee Favorability",'Table2'[Employee Favorability],"Week number",'Table2'[Week number])
    )

vyadongfmsft_1-1666947222170.png

 

I think this is the result you want:

vyadongfmsft_2-1666947248430.png

Best regards,

Yadong Fang

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

Thank you! This works but would it be possible to count the values from each slicer of the table, not the UNIONed table? This may be my last query. I really appreciate your assistance on this!

v-yadongf-msft
Community Support
Community Support

Hi @RLSid17 ,

 

I have two test tables with common columns.

 

Table1:

vyadongfmsft_0-1666938785392.png

 

 Table2:

vyadongfmsft_1-1666938821344.png

 

You can merge two tables with following DAX:

NewTable = UNION('Table1','Table2')

 

You will get a new table like this:

vyadongfmsft_2-1666938921949.png

 

Then you can count the values of 1 column from multiple datasets.

vyadongfmsft_3-1666938946797.png

 

If I misunderstand your demands, please feel free to contact us in time.

 

Best regards,

Yadong Fang

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

 

Hi @v-yadongf-msft 

Thank you for your response! I have tried what you suggested but an error occurred:

RLSid17_0-1666942349622.png

Each of the tables has a different number of columns, is there a way to use the UNION function with only 1 column for each table?

Hi @RLSid17 ,

 

If your datasets have different columns, please try:

 

NewTable2 = UNION(
    SELECTCOLUMNS('Table1',"Employee Favorability",'Table1'[Employee Favorability]),
    SELECTCOLUMNS('Table2',"Employee Favorability",'Table2'[Employee Favorability])
    )

 

vyadongfmsft_0-1666943146344.png

 

 

 

Please refer the attached pbix file.

 

Best regards,

Yadong Fang

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

Yes, this works! Thank you!

But there is one problem and I forgot to mention it initially, apologies for that. I have here the report that I'm doing:

RLSid17_0-1666945302568.png

So the one you suggested, it works but it counts all the data which is expected. But I wanted it to be filtered, for example, when I select the week number it will change the number of responses and also the calculation of the employee favorability. I apologize if it is confusing and this is a lot more complex than expected for me.

Is there a way to count the values when it is filtered?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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