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

Two columns related to date calendar

Hi friends.

 

I have the following table:

Tabla1.jpg

 

And I need to show it like this:

Tabla2.jpg

 

The columns "PLAN AC" and "REAL AC" are running totals of PLAN and REAL.

 

Thanks for your help!

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

HI  @MauroBote 

For your case, just create two inactive relationship with date table.

4.JPG

Then create four measure as below:

 

PLAN = CALCULATE(SUM('Table'[PESO]),USERELATIONSHIP('Date'[Date],'Table'[PECHA PLAN]),'Table'[PECHA PLAN]<>BLANK())

REAL = CALCULATE(SUM('Table'[PESO]),USERELATIONSHIP('Date'[Date],'Table'[FECHA REAL]),'Table'[FECHA REAL]<>BLANK())

PLAN AC = CALCULATE([PLAN],FILTER(ALLSELECTED('Date'[Date]),'Date'[Date]<=MAX('Date'[Date])))

REAL AC = CALCULATE([REAL],FILTER(ALLSELECTED('Date'[Date]),'Date'[Date]<=MAX('Date'[Date])))

 

Result:

3.JPG

 

Regards,

Lin

Community Support Team _ Lin
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-lili6-msft
Community Support
Community Support

HI  @MauroBote 

For your case, just create two inactive relationship with date table.

4.JPG

Then create four measure as below:

 

PLAN = CALCULATE(SUM('Table'[PESO]),USERELATIONSHIP('Date'[Date],'Table'[PECHA PLAN]),'Table'[PECHA PLAN]<>BLANK())

REAL = CALCULATE(SUM('Table'[PESO]),USERELATIONSHIP('Date'[Date],'Table'[FECHA REAL]),'Table'[FECHA REAL]<>BLANK())

PLAN AC = CALCULATE([PLAN],FILTER(ALLSELECTED('Date'[Date]),'Date'[Date]<=MAX('Date'[Date])))

REAL AC = CALCULATE([REAL],FILTER(ALLSELECTED('Date'[Date]),'Date'[Date]<=MAX('Date'[Date])))

 

Result:

3.JPG

 

Regards,

Lin

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

You could connect both dates to the Calendar table. This would create a inactive relationship which you could get around using USERELATIONSHIP.

 

That being said, it would be very easy to just leave the tables completely unrelated and do this:

 

PLAN AC =
  VAR __Table = FILTER('Table1','Table1'[FECHA PLAN]<='Table2'[CALENDARIO])
RETURN
  SUMX(__Table,[PESO])

REAL AC =
  VAR __Table = FILTER('Table1','Table1'[FECHA REAL]<='Table2'[CALENDARIO])
RETURN
  SUMX(__Table,[PESO])

@ 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...
amitchandak
Super User
Super User

You can connect both tables to the same date calendar and use userelation and cross filter as per need. Please find my example on mu blog on similar lines

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

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.