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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
tone_radeu
Frequent Visitor

How to make a percentage value in a table using values from different rows

Hello all!

I'm currently in need of help for this problem:
I have this example table here, that represents a user interaction in a page i'm currently working on, as represented below:

module namemodule eventviewsclicks
report_aback 5
report_aforward 2
report_ascreen10 

 

And I need to calculate the people that acessed a page and clicked on a button, and make a percentage of it.
Since i know that the person that has clicked on a button HAS accessed the page, I do not really need its views in the table, but i need to grab that number and divide by clicks of that button. So it becomes somwthing like this:

module namemodule eventclicksCTR
report_aback550%
report_aforward220%


Is it possible to do something like this in powerBI?

Thanks in advance!

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@tone_radeu 

I created  table:

Fowmy_0-1705682029598.png


The CRT Measure:

CTR = 
VAR __Module = SELECTEDVALUE( Table24[module name] )
VAR __Clicks = SUM(Table24[clicks])
VAR __Views = 
    CALCULATE(
        SUM(Table24[views]),
        Table24[module name] = __Module,
        Table24[module event] = "screen"
    )
VAR __Result = DIVIDE( __Clicks,__Views)
RETURN
    __Result


Result:

Fowmy_1-1705682065931.png

 



 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

4 REPLIES 4
Fowmy
Super User
Super User

@tone_radeu 

I created  table:

Fowmy_0-1705682029598.png


The CRT Measure:

CTR = 
VAR __Module = SELECTEDVALUE( Table24[module name] )
VAR __Clicks = SUM(Table24[clicks])
VAR __Views = 
    CALCULATE(
        SUM(Table24[views]),
        Table24[module name] = __Module,
        Table24[module event] = "screen"
    )
VAR __Result = DIVIDE( __Clicks,__Views)
RETURN
    __Result


Result:

Fowmy_1-1705682065931.png

 



 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

It worked just fine. Thank you!

Just so i can remember this later on, how does it work?

@tone_radeu 

Here are the steps, broken down based on the provided DAX code:


Get Module Name:

Store the selected module name from the column "module name" in a variable named __Module.

Calculate Total Clicks:

Sum up the values in the "clicks" column of Table24 and store the result in a variable named __Clicks.

Calculate Total Views for Screen Events:

Calculate the sum of "views" in Table24 but only for the selected module and events of type "screen".
Store this result in a variable named __Views.

Calculate Click-Through Rate (CTR):

Divide the total clicks (__Clicks) by the total views for screen events (__Views) and store the result in a variable named __Result.

Return the CTR:

Return the calculated CTR (__Result) as the final result of the measure.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

bhanu_gautam
Super User
Super User

@tone_radeu , You can create a measure for that

 

CTR =
DIVIDE(
YourTable[clicks],
CALCULATE(
SUM(YourTable[clicks]),
FILTER(
YourTable,
YourTable[module name] = EARLIER(YourTable[module name])
)
),
0
)

 

Please accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.