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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
data_insights
Microsoft Employee
Microsoft Employee

Calculate percentages dynamically when filters are applied

I have two tables, I want to calculate percentage users using NumUsers from Table 1 and Totalusers from Table 2. 

 

I want to show , Percentage users who performed an action based on the Platform and usertype combination . Platform and UserType will be slicers and the percentage has to change based on filters applied.

 

Example : Percentage of Users who clicked on "Subscribe" should be 10/10 (NumUsers from row 1 of table 1)/ (Chrome Paid TotalUsers) instead of 10/100 (Numusers from row1 of table1/ Totalusers across all platforms and usertypes).

 

I tried merging the platform and usertype columns to create a relationship between the two tables but that did not work as expected.

Table 1: UserActions

 

ActionPlatformUserTypeNumUsers
SubscribeChromePaid10
SubscribeEdgeFree5
Click  HelpEdgePaid6
Click  HelpChromeFree5
Click  HelpFireFoxFree4
Click  HelpFireFoxPaid4
Search EdgeFree4
Search EdgePaid6
Search ChromeFree10

 

Table 2: Total Users

PlatformUserTypeTotalUsers
ChromePaid10
ChromeFree20
EdgePaid20
EdgeFree15
FireFoxPaid15
FireFoxFree 20

 

Any help is appreciated.

1 REPLY 1
DataInsights
Super User
Super User

@data_insights, see the data model below:

 

DataInsights_0-1599341898023.png

 

Create measure:

 

% Users = 
VAR vNumUsers = SUM ( UserActions[NumUsers] )
VAR vTotalUsers = SUM ( TotalUsers[TotalUsers] )
RETURN
DIVIDE ( vNumUsers, vTotalUsers )

 

Result:

 

DataInsights_1-1599341922934.png

 





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

Proud to be a Super User!




Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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