Forum Discussion

marquesjef's avatar
marquesjef
Regular Visitor
2 years ago
Solved

Challenge Creating Cumulative Chart in Power BI with Distinct Token Count

In a table named 'token_ativos' with a column named 'created_at' for dates and a 'token_id' column containing the IDs of active tokens, where the 'created_at' column represents the creation date of t...
  • ValtteriN's avatar
    2 years ago

    HI,

    I recommend checking out this article by SQLBI: Computing running totals in DAX - SQLBI
    Also in February Power BI udate visual calculations are now available in preview. Here is an example video about these: Power BI Feb 2024 Update: Visual Calculations Walkthrough! - YouTube

    As for your dax:
    var _mdate = max('Calendar'[date)
    return
    CALCULATE(COUNT('token_ativos'[ 'token_id']), ALL('Calendar'),'Calendar'[date]<= _mdate) 

    This assumes ou have calendar table and relation between it and your fact table.

    Here is an alternative with YTD.

    CALCULATE(COUNT('token_ativos'[ 'token_id']),DATESYTD('Calendar'[date])).

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/