The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a project baseline fact table, looks like below. I need to create a measure will will add out the baseline of each project (column [max workdays]) by customer and project responsible person and the filtered yearmonth-1month. The baseline of each project may change over time, so it's important that the measure takes filtered yearmonth into consideration.
Below is the measure I have created. It looks the max(Fact_project_baseline_summarize[max workdays] part doesn't take into consideration the filter() condition I have created. Can someone help? The correct total baseline of customer MBC should be 1181 days.
I have also created a sample power bi file.
https://www.dropbox.com/s/gjmqdzciksqjhqc/Project%20test.pbix?dl=0
****************************************************************
*******************************************************************************************
Solved! Go to Solution.
You need to wrap the MAX in CALCULATE to do the context transition.
total baseline_closed_month2 =
VAR CurrDate = MAX ( Dim_Date[Date] )
VAR PrevMonthStart = EOMONTH ( CurrDate, -2 ) + 1
VAR Baseline_closed_month2 =
SUMX (
FILTER (
Fact_project_baseline_summarize,
Fact_project_baseline_summarize[Baseline_Date] = PrevMonthStart
),
CALCULATE ( MAX ( Fact_project_baseline_summarize[max workdays] ) )
)
RETURN
Baseline_closed_month2
I think you could probably simplify this assuming each project doesn't have more than one row per baseline date.
total baseline_closed_month2 =
VAR CurrDate = MAX ( Dim_Date[Date] )
VAR PrevMonthStart = EOMONTH ( CurrDate, -2 ) + 1
RETURN
CALCULATE (
SUM ( Fact_project_baseline_summarize[max workdays] ),
Fact_project_baseline_summarize[Baseline_Date] = PrevMonthStart
)
You need to wrap the MAX in CALCULATE to do the context transition.
total baseline_closed_month2 =
VAR CurrDate = MAX ( Dim_Date[Date] )
VAR PrevMonthStart = EOMONTH ( CurrDate, -2 ) + 1
VAR Baseline_closed_month2 =
SUMX (
FILTER (
Fact_project_baseline_summarize,
Fact_project_baseline_summarize[Baseline_Date] = PrevMonthStart
),
CALCULATE ( MAX ( Fact_project_baseline_summarize[max workdays] ) )
)
RETURN
Baseline_closed_month2
I think you could probably simplify this assuming each project doesn't have more than one row per baseline date.
total baseline_closed_month2 =
VAR CurrDate = MAX ( Dim_Date[Date] )
VAR PrevMonthStart = EOMONTH ( CurrDate, -2 ) + 1
RETURN
CALCULATE (
SUM ( Fact_project_baseline_summarize[max workdays] ),
Fact_project_baseline_summarize[Baseline_Date] = PrevMonthStart
)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
94 | |
80 | |
63 | |
56 |
User | Count |
---|---|
248 | |
122 | |
110 | |
77 | |
70 |