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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Problem showing Monthly Plan with Mtd Plan in a Table Visual

Im looking for help here with having my table show A Mtd Running Plan total along side of my plan for the month. My plan for the month always sits on the first of the month. What I created was a DAX to give me the Elapsed Days in the month, based on the end date the user chooses. 

Elspased Days (Measure)

mElapsedMatPlanDays = VAR myEndDate =[mEndDate] Var MyStartDate=[mMonthStart]
RETURN CALCULATE(MAX('V_PBI_Global_Attainment'[ElapsedDays]),V_PBI_Global_Attainment[Date]=myEndDate,V_PBI_Global_Attainment[Plant]="PS3010",V_PBI_Global_Attainment[IsPlan]="Y")
 
I also have a Daily Plan which is sitting in the First of the month record as well.
mPlanDaily = VAR myStartDate=[mMonthStart]  (Measure)
Return
Calculate(Max(V_PBI_Global_Attainment[DailyPlan]),V_PBI_Global_Attainment[isPlan]="Y",V_PBI_Calendar[Date]=myStartDate,V_PBI_Global_Attainment[Plant]="PS3010")
 
Here I take what I have above and just multiply....But it wont show in my table visual..
(Multiply my Measures)
mPlanMaterialMtd = VAR myElapsed=[mElapsedMatPlanDays] var myDailyPlan= [mPlanDaily] RETURN
myDailyPlan*myElapsed
 
I figure I only need to take the elapsed days and multiply it by the daily plan and that should give me my total MTD plan, but I get all blanks. Yet if I hard code a number say like 4, then the table will show the MTD for 4 days.
 
I believe I know what the issue is in that I have my plan sitting in the First of the month while the Elapsed days obviously sits in whatever day I have chosen at the end date. Is there a way to have the First of the month plan for a product show in the tablewith the next comumn showing the calculated month to date plan?
 
 
My table is blank...No Mtd Plan and No Elapsed Days.. In this case I have used 5/1/21-5/10/21 which is 5 Elapsed Working Days..
 I want the Daily Plan x5 days to show in the column mPlanMaterialMtd..
mmanisca_2-1620841643516.png

 


 


 

 
 
 
2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Can you share the codes for measures [mEndDate] and [mMonthStart]? You could also put both of them into the table visual to check if they get the correct dates or a blank value.

 

Or you could try modifying the [mElapsedMatPlanDays] measure into below one.

 

mElapsedMatPlanDays = VAR myEndDate =[mEndDate] Var MyStartDate=[mMonthStart]
RETURN CALCULATE(MAX('V_PBI_Global_Attainment'[ElapsedDays]),ALL(V_PBI_Calendar[Date]),V_PBI_Global_Attainment[Date]=myEndDate,V_PBI_Global_Attainment[Plant]="PS3010",V_PBI_Global_Attainment[IsPlan]="Y")
 
If this still doesn't solve this problem, can you share some sample data (remove sensitive info) and relationships between tables so that I can help further. The cause is possibly in the filter context.
 
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
Anonymous
Not applicable

Hello! Thank you for reaching out to me! 

 

I tried the measure you showed me but it's still not working out.

 

Below are the measures you asked me for...

mMonthStart = VAR myEndDate=[mEndDate] RETURN CALCULATE(STARTOFMONTH(V_PBI_Global_Calendar[Date]),V_PBI_Global_Calendar[Date]=myEndDate)
 
mEndDate = var _SELECTEDDATE= MAX(V_PBI_Global_Calendar[Date])
RETURN
CALCULATE(
TREATAS({_SELECTEDDATE},'V_PBI_Global_Calendar'[Date] ))
 
So in summary, the plan is always shown on the first day of the month. Thats where I use Month start and isplan='Y" . Now that leaved me with the problem of course where all my production occurs on any day in the month from the first to the last! I'm trying to put all the results into the first of the month based on what the user chooses as their end date..

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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