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
srinivas258
Helper I
Helper I

Cumulative total on two tables

Hello all,

Below are the two tables I have in my model (Fact and Dim). The join between the two tables is based on ID.

 

Fact Table 
IDTotalStop
10031
20052
30043
40014

 

Dim 
IDName
100AA
200BB
300CC
400DD

 

Output :

 

Output   
StopNameTotalRunning Total
1AA33
2BB58
3CC412
4DD113

 

I got the running total working using the below formula but it works as long as I have columns from Fact table ONLY. As soon as I place column from Dim table (i.e Name) the running total stops working and it displays the actual totals instead.

RT = CALCULATE(SUM(Table[Fact Table]),filter(allselected(Fact Table),Fact Table[Stop] <=max(Fact Table[Stop])))

I think I need to extend my DAX further and add Dim table to above formula but I am struck how this can be done. Can anyone please help on this. Thank you.

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @camargos88 ,

Based on the data and formula you currently provide, it can return the correct value. Could you please provide some screen shots about the below scenario? We need this information to see if we missed anything...


As soon as I place column from Dim table (i.e Name) the running total stops working and it displays the actual totals instead.

culmulative.JPG

Best Regards

Rena

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

View solution in original post

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @camargos88 ,

Based on the data and formula you currently provide, it can return the correct value. Could you please provide some screen shots about the below scenario? We need this information to see if we missed anything...


As soon as I place column from Dim table (i.e Name) the running total stops working and it displays the actual totals instead.

culmulative.JPG

Best Regards

Rena

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

Hi @v-yiruan-msft  and @camargos88 

 

Thanks for you inputs. Actually upon investigation found that the join between fact and dim is many to many which is causing the issue. There are some duplicates in dim table which we removed from backend table and the formula that I posted worked without any issues.  Thanks again it was backend table issue at the end. 

camargos88
Community Champion
Community Champion

Hi @srinivas258 ,

 

I tried your measure here, it worked. 

How are you relating the tables ?

 

directquery_sqlserverdb.png

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



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.