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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Dax Sum with multiple filter

I have the following problem.

I have a table with the following columns: date, department, value1, value2, value3 (measure value1/value2)

 

Now I would like to have an additional value4.

This value4 should summarize the value3 for the past 30 days for every single department.

There should be the value4 on date 2019-01-31 = sum(value3) from date 2019-01-01 to 2019-01-30 for each department.

 

Should look like this 

datedepartmentvalue1value2value1/value2sum(value1/value2) for the last 30 days

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can apply these measures to your dataset.

Value3 = SUMX( table, table[value1] / table[value2] )
value4 = 
CALCULATE(
    [Value3], 
    DATESINPERIOD( 'Calendar'[Date], MAX( 'Calendar'[Date] ), -30, DAY ),
    ALLEXCEPT( 'table', 'table'[Department] )
)

DATESINPERIOD is a Time intelligence function so it will require date dimension/calendar table.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

 

View solution in original post

4 REPLIES 4
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can apply these measures to your dataset.

Value3 = SUMX( table, table[value1] / table[value2] )
value4 = 
CALCULATE(
    [Value3], 
    DATESINPERIOD( 'Calendar'[Date], MAX( 'Calendar'[Date] ), -30, DAY ),
    ALLEXCEPT( 'table', 'table'[Department] )
)

DATESINPERIOD is a Time intelligence function so it will require date dimension/calendar table.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

 

Anonymous
Not applicable

@Mariusz 

Thank you very much.

 

I forgot to mention something.

 

The data model contains of 5 Tables:

 

DIM Tables: Department, Date

Fact Tables: Fact1 with value 1, Fact2 with value 2

Measure: Measure 1 = value 1 / value 2

 

Both Fact Tables have relations to both dim tables

 

date (from Date dim)department ( from Department dim)value 1 (from Fact1)value 2 (from Fact2)value 3 (from Measure 1)value 4 (from Measure 1)
    sum(Fact1[Value 1])/sum(Fact2[Value 2])sum of value 3 for last 30 days for each department

 

 

Hi @Anonymous ,

 

kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Can you create a data sample?

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.