The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Is it possible to adjust the following measure:
Hi @Anonymous ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Best Regards,
Clara Gong
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @bhanu_gautam. Thanks for your response and help. I tried the formula, but it doesn't seem to work correctly.
1. It doesn't give me the right data from my API RFT for the current month. The previous formula did.
2. It still shows (blank) without me setting a date filter for the current month.
3. Data is not registered for all the previous months where there is API RFT data. The previous formula did.
I hope this feedback is useful, and thank you so much for your help!!
@Anonymous , Try using
CurrentMonthRFTYTD =
VAR CurrentMonth = MONTH(TODAY())
VAR CurrentYear = YEAR(TODAY())
VAR MaxDate = MAX('analysis vwTime'[Date])
VAR MaxMonth = MONTH(MaxDate)
VAR MaxYear = YEAR(MaxDate)
RETURN
IF(
MaxYear > CurrentYear || (MaxYear = CurrentYear && MaxMonth > CurrentMonth),
BLANK(),
DIVIDE(
CALCULATE(
SUM('API RFT'[RFT]),
FILTER(
'analysis vwTime',
YEAR('analysis vwTime'[Date]) = CurrentYear &&
MONTH('analysis vwTime'[Date]) = CurrentMonth
)
),
CALCULATE(
COUNT('API RFT'[RFT]),
FILTER(
'analysis vwTime',
YEAR('analysis vwTime'[Date]) = CurrentYear &&
MONTH('analysis vwTime'[Date]) = CurrentMonth
)
)
) / 100
)
API RFT % Change MoM =
VAR CurrentMonthRFTYTD = [CurrentMonthRFTYTD]
VAR PreviousMonthRFTYTD = [PreviousMonthRFTYTD]
RETURN
IF(
ISBLANK(CurrentMonthRFTYTD) || ISBLANK(PreviousMonthRFTYTD),
BLANK(), -- Return BLANK instead of 0
CurrentMonthRFTYTD - PreviousMonthRFTYTD
)
If you still face any issue, please share sample data to validate
Proud to be a Super User! |
|
Hi @bhanu_gautam. Thanks for your response.
The formula is unfortunately still not working as intended. I forgot to mentin, but the measure should still show the percentage as a YTD but for the currenth month only. So maybe something like this still?
@Anonymous , you can modify the measure to dynamically calculate the value for the current month.
CurrentMonthRFTYTD =
VAR CurrentMonth = MONTH(TODAY())
VAR CurrentYear = YEAR(TODAY())
VAR MaxDate = MAX('analysis vwTime'[Date])
VAR MaxMonth = MONTH(MaxDate)
VAR MaxYear = YEAR(MaxDate)
RETURN
IF(
MaxMonth > CurrentMonth && MaxYear >= CurrentYear,
BLANK(),
DIVIDE(
CALCULATE(
SUM('API RFT'[RFT]),
FILTER(
'analysis vwTime',
YEAR('analysis vwTime'[Date]) = CurrentYear &&
MONTH('analysis vwTime'[Date]) = CurrentMonth
)
),
CALCULATE(
COUNT('API RFT'[RFT]),
FILTER(
'analysis vwTime',
YEAR('analysis vwTime'[Date]) = CurrentYear &&
MONTH('analysis vwTime'[Date]) = CurrentMonth
)
)
) / 100
)
For your API RFT % Change MoM measure, you can keep it as is, since it relies on the CurrentMonthRFTYTD measure to provide the current month's data.
API RFT % Change MoM =
VAR CurrentMonthRFTYTD = [CurrentMonthRFTYTD]
VAR PreviousMonthRFTYTD = [PreviousMonthRFTYTD]
RETURN
IF(
ISBLANK(CurrentMonthRFTYTD) || ISBLANK(PreviousMonthRFTYTD),
BLANK(), -- Return BLANK instead of 0
CurrentMonthRFTYTD - PreviousMonthRFTYTD
)
Proud to be a Super User! |
|
User | Count |
---|---|
25 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
31 | |
10 | |
10 | |
10 | |
9 |