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.
Hello Team,
This is with regards to the topic - https://community.powerbi.com/t5/Desktop/Calculate-Monthly-Growth-that-would-respond-to-slicers-for/...
It worked before but after a month when I try to filter by country, it doesn't show correct values anymore.
See below if not filtered:
When filtered by a specific country:
See code being used below:
==============================================================================
Call Count PM =
VAR CurrentYearMonth = SELECTEDVALUE('Return to Office'[YearMonthNum])
VAR PreviousYearMonth =
CALCULATE(
MAX('Return to Office'[YearMonthNum]),
ALLSELECTED('Return to Office'),
KEEPFILTERS('Return to Office'[YearMonthNum] < CurrentYearMonth)
)
VAR Result =
CALCULATE(
[Internal Call Count No Blank],
'Return to Office'[YearMonthNum] = PreviousYearMonth,
REMOVEFILTERS('Return to Office')
)
RETURN
Result
==============================================================================
Call Count Diff PM =
VAR CallCountCurrentMonth = [Internal Call Count No Blank]
VAR CallCountPrevMonth = [Call Count PM]
VAR Result =
DIVIDE(
CallCountCurrentMonth - CallCountPrevMonth,
(NOT ISBLANK (CallCountCurrentMonth))*(NOT ISBLANK (CallCountPrevMonth))
)
RETURN
Result
==============================================================================
% Call Count Monthly Growth =
DIVIDE(
[Call Count Diff PM],
[Call Count PM]
)
==============================================================================
Let me know what I'm doing wrong.
Solved! Go to Solution.
I resolved the issue.
I added ALL ( 'Date' )
Then removed REMOVEFILTERS
I resolved the issue.
I added ALL ( 'Date' )
Then removed REMOVEFILTERS
Advise you to have a date table. Code will be more simple and more efficient.
Any code/logic suggestions?
Almost the same code that you are using now. Just there is no need to use ALLSELECTED as the date will be filtered using a separate table. Please provide more details about your data and its granularity then might be able to help you further
ok. so my data is counting call counts from a video conferencing device per month.
so i need to be able to see growth rate of calls per month.
it shows the correct percentage if not filtered by country.
the issue shows up when i filter by country or city or office location.
Hi @swaggerboy69,
According to your description, it sounds like multiple aggregates calculate issues on DAX formulas.
For this scenario, you can try to add a variable with summarizing function to group the calculated result based on current category fields. Then you can use the iterator function sumx to apply the second aggregate to summary previous results:
Measure Totals, The Final Word
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
117 | |
105 | |
69 | |
67 | |
43 |
User | Count |
---|---|
148 | |
103 | |
103 | |
88 | |
66 |