cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kjartank Regular Visitor
Regular Visitor

Problem showing percentagen in UNION

Hi

 

I want to use UNION on a number of columns and the same number of measures, to make it more manageable to show in tables. I have made measures, to show the percentage of respondents with a certain answer. The measures look like this and work as they should.

% NAME = 
VAR lastperiod =
    CALCULATE ( MAX ( Tabel1[turnr] ); ALLNOBLANKROW ( Tabel1 ) )
RETURN
    DIVIDE (
        CALCULATE (
            COUNTROWS ( Tabel1 );
            FILTER (
                Tabel1;
                Tabel1[turnr] = lastperiod
                    && Tabel1[COLUMN] = "Don't know/no experience"
            )
        );
        CALCULATE (
            COUNTROWS ( Tabel1 );
            FILTER ( Tabel1; Tabel1[turnr] = lastperiod )
        )
    )

When I try to make a UNION table, I run into problems. The code I've written looks like this.

 

Don't know = UNION (
SELECTCOLUMNS (Tabel1; "Attribute"; "01."; "Answer"; Tabel1[% check-in] );
SELECTCOLUMNS (Tabel1; "Attribute"; "02."; "Answer"; Tabel1[% Cabin] );
SELECTCOLUMNS (Tabel1; "Attribute"; "03."; "Answer"; Tabel1[% Service] );
Etc..

It should load fine, but I only get a whole number from the table. I simply can't get it to show me a 0,02 or a percentage. What am I doing wrong?

 

UNION.PNG

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-ljerr-msft
Microsoft

Re: Problem showing percentagen in UNION

Hi @kjartank,

 

Could you try using the formula below to see if it works in your scenario? Smiley Happy

Don't know =
UNION (
    SELECTCOLUMNS ( Tabel1; "Attribute"; "01."; "Answer"; Tabel1[% check-in] / 100 );
    SELECTCOLUMNS ( Tabel1; "Attribute"; "02."; "Answer"; Tabel1[% Cabin] / 100 );
    SELECTCOLUMNS ( Tabel1; "Attribute"; "03."; "Answer"; Tabel1[% Service] / 100 )
)

 

Regards

View solution in original post

4 REPLIES 4
Super User IV
Super User IV

Re: Problem showing percentagen in UNION

In your new UNION table, can you set the formatting of the columns?


I have book! Learn Power BI from Packt


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

Proud to be a Datanaut!

kjartank Regular Visitor
Regular Visitor

Re: Problem showing percentagen in UNION

Hi @Greg_Deckler

 

Yes, I can set the formatting of the columns. But instead of showing "0,02", when I choose a decimal number, it just shows "2". And therefore everthng becomes the valuex100, when i format as Percent.

It seems strange, because I when I format the measures as numbers, they should go over as "0,02" and not "2". That should only happen when they are formatted as percentages.

 

Microsoft v-ljerr-msft
Microsoft

Re: Problem showing percentagen in UNION

Hi @kjartank,

 

Could you try using the formula below to see if it works in your scenario? Smiley Happy

Don't know =
UNION (
    SELECTCOLUMNS ( Tabel1; "Attribute"; "01."; "Answer"; Tabel1[% check-in] / 100 );
    SELECTCOLUMNS ( Tabel1; "Attribute"; "02."; "Answer"; Tabel1[% Cabin] / 100 );
    SELECTCOLUMNS ( Tabel1; "Attribute"; "03."; "Answer"; Tabel1[% Service] / 100 )
)

 

Regards

View solution in original post

kjartank Regular Visitor
Regular Visitor

Re: Problem showing percentagen in UNION

@v-ljerr-msft

 

That worked beautifully! Thanks a lot 🙂 I wasn't aware that I could put calculations in a UNION formula.

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors