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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
LiborK
Frequent Visitor

Running total line until last day from chart

Hello,

I am new in dax.

Problem: I have a table which have 3 columns (ID,TYPE,DATE). ID+TYPE is unique combination.

I create running total measure: 

CALCULATE(

    DistinctCountID,

    FILTER(

        ALLSELECTED(DATE,

        ISONORAFTER(DATE, MAX(DATE), DESC)

    )

)

The result of the CHART IS: 

LiborK_0-1663938638014.png

But I would like to see this: 

LiborK_2-1663938793102.png

 

How can I rewrite the query to be able to see the redline at least a straight, if there will be no data for red TYPE in the last DATE in the chart?  

(BTW: I can't create another simple table, because the ID is used in model for filtering)

 

Thank you in advance.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@LiborK , You shoudl use a date table, marked as date table joined with you date of table

 

CALCULATE(

Distinctcount(Table[ID]) ,

FILTER(

ALLSELECTED('Date') , 'Date'[Date] <= Max('Date'[Date])

)

)

 

Rolling Days Formula: https://youtu.be/cJVj5nhkKBw

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

View solution in original post

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @LiborK 

 

You can try the following methods.
Sample data:

vzhangti_0-1664177159041.png

Measure = 
CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER(ALL('Table'),[Date]<=SELECTEDVALUE('Table'[Date])))

vzhangti_1-1664177240932.png

Is this similar to the output you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Hi, thank you for your answer. I tried your query, bud the result is different:

LiborK_0-1664443531755.png

The data look like this example: 

LiborK_1-1664443571731.png

 

amitchandak
Super User
Super User

@LiborK , You shoudl use a date table, marked as date table joined with you date of table

 

CALCULATE(

Distinctcount(Table[ID]) ,

FILTER(

ALLSELECTED('Date') , 'Date'[Date] <= Max('Date'[Date])

)

)

 

Rolling Days Formula: https://youtu.be/cJVj5nhkKBw

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

Thank you, you were right.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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