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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
andrea_chiappo
Helper III
Helper III

Automatically filter dates in vusualisation of cumulative sum over time of quantity

I have the following tables: CalendarDates -> DimUsers <-> DimCustomers

where the arrows indicate the relationships

 

The active relationship among them are:

CalendarTable[Date] - DimUsers[createdDate] and DimUsers[userID] - DimCustomers[userID]

 

The [createdDate] indicates when a User registers to the service.

 

Following the suggestions at https://www.daxpatterns.com/cumulative-total/ I was able to calculate the 

running sum of the users as they registered over time, using the following formula:

 

CumulativeUsers = IF(
COUNTROWS(DimUsers)>0,
CALCULATE(
COUNTROWS(DimUsers),
FILTER(ALL(CalendarDimUsers), CalendarDimUsers[Date] <= MAX(CalendarDimUsers[Date]))
),
0
)
 
The headache now's that, when I choose a specific customer via slicer, this selection does not 
narrow down the range of dates on the visualisation to match the createdDate when a user first 
and last registerd to the service.

 

In the attached screenshot, the range should be 14/10/2019 and 11/12/2019.

Instead, it always shows the entire range of the createdDate dimension.


Capture.PNG

 

Any clue on how to solve this? Many thanks

9 REPLIES 9
v-alq-msft
Community Support
Community Support

Hi, @andrea_chiappo 

 

You may try the following measure to see if it helps.

 

CumulativeUsers =
var _date = SELECTEDVALUE(CalendarDimUsers[Date])
return
IF (
    COUNTROWS ( DimUsers ) > 0,
    CALCULATE (
        COUNTROWS ( DimUsers ),
        FILTER (
            ALLSELECTED ( CalendarDimUsers ),
            CalendarDimUsers[Date] <= _date )
        )
    ),
    0
)

 

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It just leads to the same result as my calculation. It does produce the correct cumulative sum, but the date range displayed is still not what I wish for, as it does not narrow down depending on the selection

Pragati11
Super User
Super User

Hi @andrea_chiappo ,

 

On your visual, you are using a date column. This by default shows YEAR (the highhest in the hierarchy of the date).

In Power BI the dates are by default created in a hierarchy like: Year --> Quarter --> Month -->Day.

On the visual, top right corner, you will see drill-down options. Use it to drill down to your lowest hierarcy, it will show you dates.

Or the other option is - While you dragged DATE column to visual, it dragged the hierechy by default. Right click on DATE column and chnage it to the highlighted as shown below:

d1.png

Just see if this resolves your issue.

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Thank you for the quick reply Pragati

I have already checked this but the date column I'm using does not contain a hierarchy. 

I tried creating one, clicking on New Hierachy from the dropdown menu, but result's always the same

Hi @andrea_chiappo ,

 

what is the data-type of your Date column? Are you using Direct Query mode in your model?

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

the Data-type is Date and I am using the Import mode, not the Direct Query

Hi @andrea_chiappo ,

 

In Power BI a DATE data-type by-default creates an hierarchy as mentioned in my last reply.

Is it enabled on your Power BI deskop. You can check this under

File --> Options and Settings --> Options --> Global --> Data Load --> Auto date/time option

This option should be checked. If this is not checked, modify it to checked. Save your report, reopen it again.

Click on your visual. On the top right, you should see a drill-down icon.

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

yes, the option is checked but, no, it still doesn't automatically identify the date hierarchy 🙄

 

The Power Bi version is the latest (March 2020)

HI @andrea_chiappo ,

 

Can you share your .pbix file by removing sensitive information?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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