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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
OsamaAbuAsal
Regular Visitor

Date Between Issue, The Selected To Column will affect the Measure Only

Dears All,

I Have 2 Fact Tables, One of them have consumed and Recieved Quantity and another one is Aggregated table that have the Avaliable Quantity, The Two facts have a DateID column and I have a Date Dimension, Find the Below:

I have Dates from 01-01-2024 To 04-01-2024, The Available Quantity will Be always from begining of the System (Igonre the selected from Date) till the Selected To Date, The Consumed and Recieved Quantity will be affected with From Date and To Date normally.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @OsamaAbuAsal ,

 

Maybe you can refer to below formula to create measure:

Measure_ConsumedQuantity = 
CALCULATE(
    SUM(Fact_ConsumedReceived[ConsumedQuantity]),
    FILTER(
        ALL(Dim_Date),
        Dim_Date[DateID] >= MIN(Dim_Date[DateID]) &&
        Dim_Date[DateID] <= MAX(Dim_Date[DateID])
    )
)
Measure_ReceivedQuantity = 
CALCULATE(
    SUM(Fact_ConsumedReceived[ReceivedQuantity]),
    FILTER(
        ALL(Dim_Date),
        Dim_Date[DateID] >= MIN(Dim_Date[DateID]) &&
        Dim_Date[DateID] <= MAX(Dim_Date[DateID])
    )
)
Measure_AvailableQuantity = 
CALCULATE(
    SUM(Fact_Available[AvailableQuantity]),
    FILTER(
        ALL(Dim_Date),
        Dim_Date[DateID] <= MAX(Dim_Date[DateID])
    )
)
Measure_TotalQuantity = [Measure_AvailableQuantity] + [Measure_ReceivedQuantity] - [Measure_ConsumedQuantity]

vkongfanfmsft_0-1718614956617.png

Best Regards,
Adamk Kong

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @OsamaAbuAsal ,

 

Maybe you can refer to below formula to create measure:

Measure_ConsumedQuantity = 
CALCULATE(
    SUM(Fact_ConsumedReceived[ConsumedQuantity]),
    FILTER(
        ALL(Dim_Date),
        Dim_Date[DateID] >= MIN(Dim_Date[DateID]) &&
        Dim_Date[DateID] <= MAX(Dim_Date[DateID])
    )
)
Measure_ReceivedQuantity = 
CALCULATE(
    SUM(Fact_ConsumedReceived[ReceivedQuantity]),
    FILTER(
        ALL(Dim_Date),
        Dim_Date[DateID] >= MIN(Dim_Date[DateID]) &&
        Dim_Date[DateID] <= MAX(Dim_Date[DateID])
    )
)
Measure_AvailableQuantity = 
CALCULATE(
    SUM(Fact_Available[AvailableQuantity]),
    FILTER(
        ALL(Dim_Date),
        Dim_Date[DateID] <= MAX(Dim_Date[DateID])
    )
)
Measure_TotalQuantity = [Measure_AvailableQuantity] + [Measure_ReceivedQuantity] - [Measure_ConsumedQuantity]

vkongfanfmsft_0-1718614956617.png

Best Regards,
Adamk Kong

 

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

rajendraongole1
Super User
Super User

Hi @OsamaAbuAsal - Create a measure for consumed Quantity with min and max dates as below:

Consumed Quantity =
CALCULATE(
SUM(Fact_Consumed_Received[ConsumedQuantity]),
FILTER(
ALL(Dim_Date),
Dim_Date[Date] >= MIN(Dim_Date[Date]) && Dim_Date[Date] <= MAX(Dim_Date[Date])
)
)

 

like wise create another measures for reseaved quantity metric and available quantity

 

Received Quantity =
CALCULATE(
SUM(Fact_Consumed_Received[ReceivedQuantity]),
FILTER(
ALL(Dim_Date),
Dim_Date[Date] >= MIN(Dim_Date[Date]) && Dim_Date[Date] <= MAX(Dim_Date[Date])
)
)

 

create the same with your fact with available quantity and use it.

Hope it works

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.