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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
sheorans352_1
New Member

Create Measure to be used for Slicer and Filter

sheorans352_1_0-1721825895530.png

I have Kwywords and URL in Site Link May/Jun table 

I have Unique Pages/Queries

 I have page and keywords performace in Clicks, CTR and rank in DS Page And Query Table
Now I want to see URL which are appearing in sitelinks
Logic to determine URL are in site link 
Step 1: Check the Keyword in Sitelink Jun/May table (if keywords is present in table then Yes otherwise Keywords did not have site link on SERP)
Step 2: Find out URL that are in sitelink and URL that is on main ranking. (Multiple URLs ranking on same position and URL with highest CTR out of those is main URL, URLs other than highest CTR URL are links appearing in sitelink for the query)

I want to create a Slicer Named With Sitelink or W/O sitelink
whcih should give me clicks number for a URL from sitelink (sitelink can be for many queries) 
 

1 REPLY 1
sandrika
New Member

1. Create Calculated Column to Identify Keywords in Site Link Tables:
KeywordInSiteLink =
IF(
CONTAINS('Site Link Jun', 'Site Link Jun'[Keyword], 'DS Page And Query Wise'[Query]) ||
CONTAINS('Site Link May', 'Site Link May'[Keyword], 'DS Page And Query Wise'[Query]),
"Yes",
"No"
)
2. Create Measures to Determine Main URL and Site Link URLs:
Main URL Measure:
MainURL =
VAR SelectedURL = 'DS Page And Query Wise'[Landing Page]
VAR MaxCTR =
CALCULATE(
MAX('DS Page And Query Wise'[CTR]),
FILTER(
ALL('DS Page And Query Wise'),
'DS Page And Query Wise'[Query] = SELECTEDVALUE('DS Page And Query Wise'[Query])
)
)
RETURN
IF(
'DS Page And Query Wise'[CTR] = MaxCTR,
SelectedURL,
BLANK()
)
Site Link URLs Measure:
SiteLinkURLs =
VAR SelectedURL = 'DS Page And Query Wise'[Landing Page]
VAR MaxCTR =
CALCULATE(
MAX('DS Page And Query Wise'[CTR]),
FILTER(
ALL('DS Page And Query Wise'),
'DS Page And Query Wise'[Query] = SELECTEDVALUE('DS Page And Query Wise'[Query])
)
)
RETURN
IF(
'DS Page And Query Wise'[CTR] < MaxCTR,
SelectedURL,
BLANK()
)
3. Create a Slicer:

SitelinkFilter =
IF(
'DS Page And Query Wise'[KeywordInSiteLink] = "Yes",
"With Sitelink",
"Without Sitelink"ClicksFromSiteLinks =
CALCULATE(
SUM('DS Page And Query Wise'[Clicks]),
FILTER(
'DS Page And Query Wise',
'DS Page And Query Wise'[SitelinkFilter] = "With Sitelink"
)
)

)
4. Visualize Clicks for URLs from Site Links:
ClicksFromSiteLinks =
CALCULATE(
SUM('DS Page And Query Wise'[Clicks]),
FILTER(
'DS Page And Query Wise',
'DS Page And Query Wise'[SitelinkFilter] = "With Sitelink"
)
)


Use the provided DAX code to create the necessary calculated columns and measures in the appropriate tables. Add a slicer visual to your report and use the 'SiteLinkFilter' column for filtering.Use the 'ClickFromSiteLinks' measure to display clicks for URLs from site links in a card or table visual. Use other visuals as needed to display URLs, CTR, and other metrics based on the slicer selection.



 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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