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
nicq10
New Member

Sum of Rankx measure

Overall objective:

I am bringing in pageview data from Google Analytics for a given property. Based on the data, I want to be able spot trends in the relative rise or drop in popularity of various pages over any given period of time.

 

What I have so far:

To start, I have a measure ("Daily Rank") which calculates a page's rank relative to all other pages for a given day, based on the number of pageviews each page received. Here's a mockup of what that data looks like when added to a visual:

 

Table Mockups.png

 

I have been able to get to this point using the RANKX function like this:

 

 

Daily Rank = 
     Rankx(
          ALL('All Websites - Pageviews'[Page]),
          [Total Current Pageviews]
)

Where [Total Current Pageviews] is defined as:

 

Total Current Pageviews = sum([Pageviews])

 

Now I want to do a few more things:

  1. Get a sum of each page's Daily Rank for whatever date period is being viewed. In the example above, that sum would be 72.
  2. Get an average of each page's daily rank for whatever date period is being viewed. In the example above, that average would be 14.4.
  3. Get the variance (difference) of daily rank from the average for each row
  4. Get the %variance of the daily rank from the average for each row

 

If I were to pull all this into a visual, I would expect it to look something like the following:

 

Full Mockup2.png

 

My Question(s):

  1. What would the Dax formula look like for the "Cumulative Page Rank" measure?
  2. Is this a case where the "Daily Rank" measure actually needs to be calculated column instead?

My assumption here is that once I figure out what that "Cumulative Page Rank" formula should look like, the formula for the "Average Page Rank will follow the same general pattern.

 

1 REPLY 1
Greg_Deckler
Super User
Super User

This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.