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
Anonymous
Not applicable

Substract same figures from each category

Hello,

 

If possible maybe someone can support with a solution, I will try to describe my situation:

I have a growing database, each month a new version is uploaded:

 

CustomerPlanned Vol Actual VolumesSource
Daimler10050Jan-20
VW5020Jan-20
Daimler9040Feb-20
VW6020Feb-20
Daimler10040Mar-20
VW6030Mar-20

 

I would like to calculate for each of my sources ( file from Jan , file from Feb..) the difference between the planned volumes and the latest actual volumes. I make a measure to get the latest actual volumes (not sure if this is the way to go)

 

Latest actuals = var max_date = LASTDATE('Overview'[Source])
return CALCULATE(SUM('Overview'[Actual volumes]), FILTER('Overview','Overview'[Source] = max_date))

 

In the example the Daimler 40 / VW 30

Now I want to take the latest volumes and substract them from each monthl version from my database:

 

Source  Planned Vol Lates Actual VolumesDifference
JanDaimler1004060
 VW503020
FebDaimler904050
 VW603030
MarDaimler1004060
 VW603030

 

The difference should be the result. 

 

1 I don'y have any ideea how to achieve that

2 If I try a quick measure to substract the result is only substracting the figures from the March version.

 

Open to any ideas that might help.

Thank you

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

@Anonymous ,

 

Create two measures using dax as below:

Latest actuals = 
VAR max_date =
    CALCULATE(MAX( 'Overview'[Source] ), ALL(Overview))
RETURN
    CALCULATE (
        MAX( 'Overview'[Actual volumes] ),
        FILTER ( ALLEXCEPT('Overview', Overview[Customer]), 'Overview'[Source] = max_date )
    )

Result = 
MAX(Overview[Planned Vol ]) - [Latest actuals]

The result is like below:
Capture.PNG 

 

You can also refer to the attached pbix file.

 

Community Support Team _ Jimmy Tao

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

5 REPLIES 5
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Create two measures using dax as below:

Latest actuals = 
VAR max_date =
    CALCULATE(MAX( 'Overview'[Source] ), ALL(Overview))
RETURN
    CALCULATE (
        MAX( 'Overview'[Actual volumes] ),
        FILTER ( ALLEXCEPT('Overview', Overview[Customer]), 'Overview'[Source] = max_date )
    )

Result = 
MAX(Overview[Planned Vol ]) - [Latest actuals]

The result is like below:
Capture.PNG 

 

You can also refer to the attached pbix file.

 

Community Support Team _ Jimmy Tao

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

mahoneypat
Employee
Employee

It looks like you've already solved the hard part.  Why doesn't this work with the two measures you already have?

 

Difference = [Planned Volume] - [Latest Actual Vol]

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hello

I tried and it's just subtracting the figures from the March version.

To my extent I identify the actual figures for Daimler 40 / VW 30 delays, plese find example with my current status

pb.jpg

I want to subtract the March values from each source category.

Anonymous
Not applicable

Hello

I tried and it's just subtracting the figures from the March version.

To my extent I identify the actual figures for Daimler 40 / VW 30 delays, plese find example with my current status

pb.jpg

I want to subtract the March values from each source category.

Anonymous
Not applicable

Hello,

 

I tried that and  it's only substracting the figures from the March version.

In my measure it identifies the lates actual figures Daimler 40/ VW 30 , plese find example with my current status

 

pb.jpg

I want to subtract the March values from each source category.

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.