Forum Discussion
YTD Function
- 1 year ago
Its difficult to suggest any change without knowing the data model and sample data. But I will suggest
First rewrite the 'Sum of KG measure'
SUM OF KG = SUMX( ItemMaster, ( (ItemMaster[ Quantity ] * -1)* RELATED('Item'[ MAP VOL ] ) )You can reuse it in the YTD measure like this
FYTD_SumOfKG = VAR PreviousWorkingDay_ = DATEVALUE([PreviousWorkingDay]) VAR FiscalYearStartDate_ = DATEVALUE([FiscalYearStartDate]) RETURN CALCULATE ( [Sum of KG], FILTER( ItemMaster, DATEVALUE(ItemMaster[Physical date]) >= FiscalYearStartDate_ &&DATEVALUE(ItemMaster[Physical date]) <= PreviousWorkingDay_) , REMOVEFILTERS('calendar'[Year],'calendar'[Month Name]) )Intead of the above pattern I woud suggest you to use time intelligence function like DatesYTD and pass the second parameter to last date of the financial year.
FYTD_SumOfKG = CALCULATE ( [Sum of KG], DATESYTD(Calendar[Date], "6-30") )For further assitance please share the pbix file
Need a Power BI Consultation? Hire me on Upwork
Connect on LinkedIn
Did I answer your question? Mark my post as a solution! If I helped you, click on the Thumbs Up to give Kudos.
Proud to be a Super User!
Its difficult to suggest any change without knowing the data model and sample data. But I will suggest
First rewrite the 'Sum of KG measure'
SUM OF KG =
SUMX(
ItemMaster,
( (ItemMaster[ Quantity ] * -1)* RELATED('Item'[ MAP VOL ] )
)
You can reuse it in the YTD measure like this
FYTD_SumOfKG =
VAR PreviousWorkingDay_ = DATEVALUE([PreviousWorkingDay])
VAR FiscalYearStartDate_ = DATEVALUE([FiscalYearStartDate])
RETURN
CALCULATE
(
[Sum of KG],
FILTER(
ItemMaster,
DATEVALUE(ItemMaster[Physical date]) >= FiscalYearStartDate_ &&DATEVALUE(ItemMaster[Physical date]) <= PreviousWorkingDay_) ,
REMOVEFILTERS('calendar'[Year],'calendar'[Month Name])
)
Intead of the above pattern I woud suggest you to use time intelligence function like DatesYTD and pass the second parameter to last date of the financial year.
FYTD_SumOfKG =
CALCULATE
(
[Sum of KG],
DATESYTD(Calendar[Date], "6-30")
)
For further assitance please share the pbix file
Need a Power BI Consultation? Hire me on Upwork
Connect on LinkedIn
|