Forum Discussion
New Card Visual - Editing interactions for a single card
- 9 months ago
Hi Anonymous00729,
I hope you are doing well today ☺️❤️
So you have 3 Issues need to be Solved:
- Blank Previous Month in January
- Store Location Slicer Affecting Best Store Calculation
- Changing Indicator Showing Incorrect Message
First Issue
The Issue is that your Previous Month Best Store measure doesnt properly handle the case when there is no data for the previous month. Here is the corrected measure:
Previous Month Best Store = VAR CurrentMonthStart = MIN('Date'[Date]) // First day of selected month VAR PreviousMonthStart = DATE(YEAR(CurrentMonthStart), MONTH(CurrentMonthStart) - 1, 1) VAR PreviousMonthEnd = EOMONTH(CurrentMonthStart, -1) VAR HasPreviousMonthData = NOT ISBLANK( CALCULATE( [Total Revenue], 'Date'[Date] >= PreviousMonthStart, 'Date'[Date] <= PreviousMonthEnd, REMOVEFILTERS('Store'[store_location]) ) ) VAR PrevStore = IF( HasPreviousMonthData, CALCULATE( FIRSTNONBLANK( TOPN( 1, VALUES('Store'[store_location]), [Total Revenue], DESC ), 1 ), 'Date'[Date] >= PreviousMonthStart, 'Date'[Date] <= PreviousMonthEnd, REMOVEFILTERS('Store'[store_location]) ), BLANK() ) RETURN PrevStoreSecond Issue
You need to modify your Best Performing Store measure to ignore the Store Location slicer:
Best Performing Store = CALCULATE( FIRSTNONBLANK( TOPN( 1, VALUES('Store'[store_location]), [Total Revenue], DESC ), 1 ), REMOVEFILTERS('Store'[store_location]) )Final Issue
- You need to Update Change Indicator Measure too Look like that:
Best Performing Store ▲ = VAR CurrentStore = [Best Performing Store] VAR PreviousStore = [Previous Month Best Store] RETURN SWITCH( TRUE(), ISBLANK(CurrentStore) && ISBLANK(PreviousStore), BLANK(), ISBLANK(CurrentStore) || ISBLANK(PreviousStore), BLANK(), CurrentStore = PreviousStore, "No change", "Changed from " & PreviousStore & " to " & CurrentStore )if this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.
Hi Anonymous00729,
I am really glad to hear the solution worked for you! 😊
And thank you for the kind words that truly means a lot ❤️
You are doing great already! Transitioning into DAX and Power BI takes time and asking questions is the best way to grow. We all started somewhere and with the progress you are making, you will be helping others here in no time!
Always happy to help feel free to ask whenever you get stuck again 👍
Hi Ahmed-Elfeel
Thank you so much for your kind words and encouragement. I really appreciate it! 😊
This is one of the most helpful communities I've been on and it's a priviledge to learn from you and others in this forum ❤️.
I really do hope to give back to others some day when I do become more well-versed in Power BI 😅.
Until next time... Have a great weekend! 😊