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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AndreSchuck
Regular Visitor

Measure that computes the difference of a cumulative fact by day

Hey guys,

 

I have a model to display data from clients' social networks (data from posts on facebook, instagram, etc.). For each social platform, I've a dimension table (that contains basic information of a post, such as created_at date, permalink and so on) and a fact table, that have metrics (such as post impressions, post likes, etc..) with day granularity. The facts in my fact table are all cumulative.

 

I need to create a measure that computes the total impressions by post by a date range (that could be day, month, quarter, or year). In my mind, I was trying to create a measure that can do somenting like:

impressions = (impressions on last day)  - (impressions on (first day - 1 day) )

 

Here is a print of my fact table

AndreSchuck_1-1615994861906.png

 

Can you help my to find a solution for this issue ?

 

Thanks.

 

2 REPLIES 2
amitchandak
Super User
Super User

@AndreSchuck , with help from date table

 

This Day = CALCULATE(sum('Table'[impressions_organic]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(sum('Table'[impressions_organic]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
Last Day = CALCULATE(sum('Table'[impressions_organic]), previousday('Date'[Date]))

 

both column and measure ways are discussed here

Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak  Thanks for the replie.

 

The solution do not work. I've forgot to mention that the Most Recent date for each post is not same. I've created this query in Dax Studio to better exemplify what I need (in this case is the ImpressionDifference column, so I can just SUM the Impressions diferrence in order to "unaccumulate" the accumulated facts).

 

Query.png

 

I've not been able to reproduce this query in power bi.

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.