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
Chub1
New Member

Measure to calculate project volume

Hello,

I need to create a measure, that calculates the project volume (yearly quantity over several years) for each ID.

My Data structure looks like this:

Chub1_0-1690920812832.png

So for the first ID, the expected result would be 25.000 (10.000 in 2023 and 15.000 in 2024).

For the second ID, the result should be 30k + 40k + 50k = 120k.

The yearly qty does not change based one freight mode or lot sizes, so its just depending on the year.

However the first/starting year can be different for every ID, also the count of years can be 1 or up to 5 years.

On top of that, there is a special case with scenarios (e.g. ID 3). In this case, the result should be only the first scenario, so 100k in the example above.

 

On top of that, I need a measure that calculates the min sales price for each year (independent from freight mode or lot size). So result for ID 1 would be 3 for 2023 and 2 for 2024.

However for the scenario case, the result should be the sales price corresponding to the qty of the first scenario (so price 3 for 100k in example).

IDFreight ModeLot SizeYearYearly QuantitySales Price
1Sea             1.0002023                  10.000      5
1Sea             2.5002023                  10.000      4
1Sea             5.0002023                  10.000      3
1Air                 5002023                  10.000      6
1Air             1.0002023                  10.000      5
1Air             1.5002023                  10.000      4
1Sea             1.0002024                  15.000      4
1Sea             2.5002024                  15.000      3
1Sea             5.0002024                  15.000      2
1Air                 5002024                  15.000      5
1Air             1.0002024                  15.000      4
1Air             1.5002024                  15.000      3
2Truck             3.0002024                  30.000     10
2Truck           10.0002024                  30.000      9
2Air             2.0002024                  30.000     12
2Air             4.0002024                  30.000    11
2Truck             3.0002025                  40.000    9,5
2Truck           10.0002025                  40.000    8,7
2Air             2.0002025                  40.000    11
2Air             4.0002025                  40.000    10
2Truck             3.0002026                  50.000    9,5
2Truck           10.0002026                  50.000    8,7
2Air             2.0002026                  50.000    11
2Air             4.0002026                  50.000    10
3Sea           15.000Scenario 1                100.000     3
3Sea           15.000Scenario 2                150.000     2
3Sea           15.000Scenario 3                200.000     1

 

 

Thanks a lot in advance, appreciate the suggestions and help.

 

1 REPLY 1
rubayatyasmin
Super User
Super User

Hi, @Chub1 

 

this is what i could achieve. 

 

rubayatyasmin_0-1690952345828.png

 

when applied filter:

rubayatyasmin_2-1690953140000.png

 

for id 3

 

rubayatyasmin_1-1690953099285.png

 

 

Measures for the above 

ProjectVolume1 =
SUMX (
    SUMMARIZE (
        FreightTable1,
        FreightTable1[ID],
        FreightTable1[Year],
        "FirstYearlyQuantity", MIN ( FreightTable1[Yearly Quantity] )
    ),
    [FirstYearlyQuantity]
)
 
 //////////
MinSalesPrice =
CALCULATE(
    MIN(FreightTable1[Sales Price]),
    ALLEXCEPT(FreightTable1, FreightTable1[Year])
)

////

Scenario1Quantity =
CALCULATE(
    SUM(FreightTable1[Yearly Quantity]),
    FILTER(FreightTable1, FreightTable1[ID] = 3 && FreightTable1[Year] = "Scenario 1")
)

 

 

this should help or give you an idea of how to achieve your goal. 

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors