Forum Discussion
Line chart data label on min, max, current points only for dynamic hierarchy (sample solution)
- 7 months ago
v-prasare Thank You
i have been playing around with chatgpt to help me , the below works on gettinfg the last month total only but not when i roll up to qtr where i want the ucrrent or last qter total to displayThis works for last only that has start of month date
LastDateValueLabel =
VAR MaxFactDate =
CALCULATE(
MAX(FACT[Date]),
ALLSELECTED('Calc_Calendar')
)
RETURN
IF(
MAX('Calc_Calendar'[Date]) = MaxFactDate,
FACT[ActualBaseMeasAgg],
BLANK()
)
Now trying date hierarchy:VAR CurrentMaxDate =
CALCULATE(
MAX(FACT[Date]),
ALLSELECTED('Calc_Calendar')
)VAR CurrentPeriod =
SWITCH(
TRUE(),
ISINSCOPE('Calc_Calendar'[DateStartOfMonthDescr]), "Month",
ISINSCOPE('Calc_Calendar'[DateFinQuarterDescr]), "Quarter",
ISINSCOPE('Calc_Calendar'[DateFinYearDescr]), "Year",
"Other"
)RETURN
SWITCH(
CurrentPeriod,
"Month",
CALCULATE(
FACT[ActualBaseMeasAgg],
FILTER(
ALL('Calc_Calendar'),
'Calc_Calendar'[Date] = CurrentMaxDate
)
),
"Quarter",
CALCULATE(
FACT[ActualBaseMeasAgg],
DATESQTD('Calc_Calendar'[Date])
),
"Year",
CALCULATE(
FACT[ActualBaseMeasAgg],
DATESYTD('Calc_Calendar'[Date])
),
BLANK()
)
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
- icassiem7 months agoPost Prodigy
lbendlin thank you
i cant share any of the data, even though i try to to mask the data
basically, i tried creating a calaculated col for when data selected = curr mont show curr mon total sales
Example of month view
Startofmonth - Sales
01/01/25 - 1,000,000
01/02/25 - 2,000,000
01/03/25 - 3,000,000
01/04/25 - 1,000,000
01/05/25 - 5,000,000 (current) show data label for current month of 5m
but when in quarter view the same calc measure or col must show data label of 6,000,000 which is the total of current qtr, using a normal date hierarchy (year, qtr, month, date (som))
Please help?