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
luciefialova
Frequent Visitor

Getpivotdata equivalent

Hi,

 

Is there a Power BI equivalent to the getpivotdata function in Excel? Some teams within my organisation have quite messy reporting requirements (asking me to count apples and oranges) and in the past I would have done something like getpivotdata(A) + getpivotdata(B) to get the figure they need.

 

Apologies if there's a really obvious way of doing this that I've missed, I'm still fairly new to Power BI.

 

Thanks

Lucie

1 ACCEPTED SOLUTION

Hi @luciefialova,

 

I would suggest you start to learn DAX language which could calculate all the expected result for you in Power BI without return back to SQL. And it's better to read a book from beginning. Smiley Happy

 

In addition, the formula(DAX) below to calculate the sum of the two totals mentioned above is for your reference.

Measure =
SUMX (
    SUMMARIZE (
        'Attributes',
        'Attributes'[ATTRUBUTE_TYPE],
        "count of people", COUNTROWS ( Attributes )
    ),
    [count of people]
)
    + SUMX (
        SUMMARIZE (
            'transactionCF',
            'transactionCF'[CAMPAIGNCODE],
            "count of people", COUNTROWS ( transactionCF )
        ),
        [count of people]
    )

Regards

View solution in original post

4 REPLIES 4
v-ljerr-msft
Employee
Employee

Hi @luciefialova,

 

After a few research on the getpivotdata function in Excel, I don't think there is an exact equivalent function in Power BI. However, I believe it could be implemented with other DAX functions(i.e. SUMMARIZE function). So could you post your table structures with some sample data and your expected result, so that we can further assist on this issue? Smiley Happy

 

Regards

Hi,

 

Thanks for that. Maybe the problem is that I always have my SQL hat on and that's not how power BI works... I've made these two matrices, they are looking at count of people who had a tag added to their record and a count of people who made payments coded to a certain code. What the client wants to see is a sum of the two totals (130+18 and so on). In excel, I would have created these pivot tables on a hidden sheet and used getpivotdata to sum the two values and displayed just the sum figure. What I've done isn't very elegant (wait till you see my table structure 😄 I'm still working this out!!)

PowerBI.PNGCommTables.PNG

 

 

The attributes table is behind the first matrix and the transactionCF.... table behind the second one (that query finds people who made transaction AND don't have any of those attributes).

 

What's in the two tables:

attributes.PNGtransactions.PNG

 

Thanks

Lucie

Hi @luciefialova,

 

I would suggest you start to learn DAX language which could calculate all the expected result for you in Power BI without return back to SQL. And it's better to read a book from beginning. Smiley Happy

 

In addition, the formula(DAX) below to calculate the sum of the two totals mentioned above is for your reference.

Measure =
SUMX (
    SUMMARIZE (
        'Attributes',
        'Attributes'[ATTRUBUTE_TYPE],
        "count of people", COUNTROWS ( Attributes )
    ),
    [count of people]
)
    + SUMX (
        SUMMARIZE (
            'transactionCF',
            'transactionCF'[CAMPAIGNCODE],
            "count of people", COUNTROWS ( transactionCF )
        ),
        [count of people]
    )

Regards

They'll then want to see even more complicated indicators such as the count of people who had attribute A added in a time period oct/16-now against the count of people who had attribute B added in this financial year who had attribute A added in that previous time period. I used to get the numbers for them just running SQL queries every quarter but got bored of that and now I'm trying to create something in Power BI that I don't have to touch again.

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.

Top Solution Authors