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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Counting Base on Week on Week result - Day in Raw Data

Hi Senior Users,

 

Can you please help to advise on this.  Sample PBI file is here for download.

In the raw data, there is Clicks by Query, URL by Day

h_l_0-1644464019777.png

 

I have created metric for Week on Week changed Clicks:

Clicks WoW Change = 
var lastweeknum = 
CALCULATE(
    MAX('Date'[YearWeek]),
    FILTER(
        ALL('Date'),
        [YearWeek]<MAX('Date'[YearWeek])
    )
)
var lastweekamount = 
CALCULATE(
    SUM(Metrics[Clicks]),
    FILTER(
          ALL('Date'),
          [YearWeek]=lastweeknum
    )
)
return CALCULATE(SUM(Metrics[Clicks])-lastweekamount)

h_l_1-1644464278837.png

 

Then, how to get: how many URLs got more or less Clicks in this week compare to last week clicks?

For example,

For week 04-APR, 2 URLs got less Clicks, 9 URLs got more.

For week 11-APR, 3 URLs got less Clicks, 8 URLs got more.

 

Thank you.

H

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how you want to show the visualization, but I assume you want to display the result on the total row of the matrix visualization.

Please check the below picture and the attached pbix file.

 

Picture1.png

 

WoW more or less count: =
IF (
HASONEVALUE ( Metrics[URL] )
|| [Clicks WoW Change] = BLANK (),
[Clicks WoW Change],
VAR newtable =
ADDCOLUMNS (
SUMMARIZE ( ALL ( Metrics ), Metrics[URL], 'Date'[YearWeek] ),
"@countdiff", [Clicks WoW Change]
)
RETURN
"Thisweekmore: "
& COUNTROWS ( FILTER ( newtable, [@countdiff] > 0 ) ) & " / Thisweekless: "
& COUNTROWS ( FILTER ( newtable, [@countdiff] < 0 ) )
)


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how you want to show the visualization, but I assume you want to display the result on the total row of the matrix visualization.

Please check the below picture and the attached pbix file.

 

Picture1.png

 

WoW more or less count: =
IF (
HASONEVALUE ( Metrics[URL] )
|| [Clicks WoW Change] = BLANK (),
[Clicks WoW Change],
VAR newtable =
ADDCOLUMNS (
SUMMARIZE ( ALL ( Metrics ), Metrics[URL], 'Date'[YearWeek] ),
"@countdiff", [Clicks WoW Change]
)
RETURN
"Thisweekmore: "
& COUNTROWS ( FILTER ( newtable, [@countdiff] > 0 ) ) & " / Thisweekless: "
& COUNTROWS ( FILTER ( newtable, [@countdiff] < 0 ) )
)


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Thanks for the help @Jihwan_Kim , I was thinking just to make another table to list:

h_l_0-1645664526601.png

 

 

Then when apply URL, it can breakdown to see which of the URLs got more/less.

But you've provided very helpful info.

Thanks again.

Have a nice day!

 

amitchandak
Super User
Super User

@Anonymous , Use week rank on year week or week start date

example

new columns

 

Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

 

 

measure example

 

This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak  Thanks for the reply, you are always helpful. I will try this!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors