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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX Help

I do have a requriment  and need help on DAX. There is a report which pulls data from project details and Invoice tables.

When user selects the project either single select or multi selct. The data from invoice table should shown up based on Project start date.

Example:  Revenue should be picked up based on project start date >= invoice date. The user either select mutli or single selection of project name from the slicer.

 

Project Details  Invoice Table   
Project NameStart date Project NameInvoice DateRevPicked up
A1/1/2021 A1/1/2020 $ 100.00No
B1/1/2020 A1/5/2020 $ 200.00No
   A1/1/2021 $ 300.00Yes
   A2/1/2021 $ 400.00Yes
   B1/1/2019 $ 500.00No
   B1/1/2020 $ 100.00Yes
   B1/1/2021 $ 100.00Yes
   B2/1/2021 $ 200.00Yes
1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Try measure like below :

test1 = 
CALCULATE (
    MAX ( 'Project Details'[Start date] ),
    FILTER (
        ALLSELECTED ( 'Project Details' ),
        MAX ( 'Invoice Table'[Project Name] ) = 'Project Details'[Project Name]
    )
)
test2 = 
CALCULATE (
    SUM ( 'Invoice Table'[Rev] ),
    FILTER (
        ALLSELECTED ( 'Project Details' ),
        MAX ( 'Invoice Table'[Project Name] ) = 'Project Details'[Project Name]
            && MAX ( 'Invoice Table'[Invoice Date] ) >= [test1]
    )
)
test3 = SUMX('Invoice Table',[test2])

Final get :

vluwangmsft_0-1631517212355.pngvluwangmsft_1-1631517219312.pngvluwangmsft_2-1631517228677.png

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


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Try measure like below :

test1 = 
CALCULATE (
    MAX ( 'Project Details'[Start date] ),
    FILTER (
        ALLSELECTED ( 'Project Details' ),
        MAX ( 'Invoice Table'[Project Name] ) = 'Project Details'[Project Name]
    )
)
test2 = 
CALCULATE (
    SUM ( 'Invoice Table'[Rev] ),
    FILTER (
        ALLSELECTED ( 'Project Details' ),
        MAX ( 'Invoice Table'[Project Name] ) = 'Project Details'[Project Name]
            && MAX ( 'Invoice Table'[Invoice Date] ) >= [test1]
    )
)
test3 = SUMX('Invoice Table',[test2])

Final get :

vluwangmsft_0-1631517212355.pngvluwangmsft_1-1631517219312.pngvluwangmsft_2-1631517228677.png

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


Best Regards

Lucien

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.