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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JPQ
Frequent Visitor

Two Cumulative Totals in the same graph

Hi,

 

After a lot of reading, i´m still managing a problem inserting two measures for cumulative totals in the same graph.

I have a table with two date columns (Dta.CONF, Liberacao Real) both relating to a calendar table.

 

2018-11-02_103333.png 

 

I created two measures to calculate cumulative totals:

 

Realizado Acumulado =
CALCULATE(SUM('IW39 Filtrada'[Cust.tot.reais]); 
  FILTER(ALLSELECTED('IW39 Filtrada');
    'IW39 Filtrada'[dta.Conf] <= MAX('IW39 Filtrada'[dta.Conf])); 
  USERELATIONSHIP(Datas[Date];'IW39 Filtrada'[Dta.CONF]))

 

Liberado Acumulado = 
CALCULATE(SUM('IW39 Filtrada'[Custos tot.plan]); 
  FILTER(ALLSELECTED('IW39 Filtrada');
    'IW39 Filtrada'[Liberação real] <= MAX('IW39 Filtrada'[Liberação real]
)); USERELATIONSHIP(Datas[Date];'IW39 Filtrada'[Liberação real]))

When i try to put this measures on a line graph, one of them is always flat and i can´t seem to understand why. I tried to inactive relationships between the tables but it didn't work.

 

2018-11-02_104111.png

 

2018-11-02_104202.png

 

I bet its something very simple but i need help to correct it.

Thx

2 ACCEPTED SOLUTIONS
v-jiascu-msft
Employee
Employee

Hi @JPQ,

 

Your formulas should work though the result could be wrong. Please try this formula instead and the demo in the attachment.

Liberado Acumulado new =
CALCULATE (
    SUM ( 'IW39 Filtrada'[Custos tot.plan] ),
    FILTER ( ALLSELECTED ( 'Datas'[Date] ), 'Datas'[Date] <= MAX ( 'Datas'[Date] ) ),
    USERELATIONSHIP ( Datas[Date], 'IW39 Filtrada'[Liberação real] )
)

Two-Cumulative-Totals-in-the-same-graph

 

Best Regards,
Dale

Community Support Team _ Dale
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

hi @v-jiascu-msft

 

Thx for the tip!

I finally works. The only thing is that it projets the upcoming months.

Thx a lot!

View solution in original post

5 REPLIES 5
v-jiascu-msft
Employee
Employee

Hi @JPQ,

 

Your formulas should work though the result could be wrong. Please try this formula instead and the demo in the attachment.

Liberado Acumulado new =
CALCULATE (
    SUM ( 'IW39 Filtrada'[Custos tot.plan] ),
    FILTER ( ALLSELECTED ( 'Datas'[Date] ), 'Datas'[Date] <= MAX ( 'Datas'[Date] ) ),
    USERELATIONSHIP ( Datas[Date], 'IW39 Filtrada'[Liberação real] )
)

Two-Cumulative-Totals-in-the-same-graph

 

Best Regards,
Dale

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

hi @v-jiascu-msft

 

Thx for the tip!

I finally works. The only thing is that it projets the upcoming months.

Thx a lot!

Greg_Deckler
Super User
Super User

I'm going to guess here that perhaps USERELATIONSHIP needs to be within the FILTER clause as well? Models like that are generally bad news. 

 

I wonder what would happen if you created 2 additional calendar tables so that you have 1 calendar table that relates to the other two and then each date in your table relates to one of those 2 calendar tables. Then you use the top calendar table date as your axis.

 

Then you would have all active relationships.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi ,

 

Thx for the answer. It seems that USERELATIONSHIP can only be apllied to the CALCULTE function.

I tried to set the date hierarchy that you mentioned, but one of the relationships came inactive.

I found out that one way to solve this problem is duplicating the data table and establishing two active relationships to the calendar table. It solves the problem, but i'm not happy with it.

You know what, another thought is that my Time Intelligence The Hard Way "quick measure" might come into play here. You should be able to use that technique without your second relationship. See what you think:

 

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

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