Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
date | department | value1 | value2 | value1/value2 | sum(value1/value2) for the last 30 days |
Solved! Go to Solution.
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.
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.
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.
Hi @Anonymous
Can you create a data sample?
User | Count |
---|---|
75 | |
75 | |
45 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |