The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, everyone!
I have this measure that works only with a selected slicer with (Month). This slicer should be every month selected with the current month.
There are a few methods for doing this on the internet but with some modifications to the Month Column (like default or today), and my measure will not work with these methods.
So I will need a solution to either modify the slicer or the measure.
o make your measure work with a slicer that always defaults to the current month, you can modify the slicer or the measure itself. Here, I'll provide you with a solution that modifies the measure to achieve this:
You can modify your measure to automatically calculate the current month without relying on the slicer selection. You can use the TODAY() function to get the current date and extract the month from it. Here's how you can modify your measure to achieve this:
DbD BV LY =
VAR workingdays = MAX('Calendar'[MTD workday column])
VAR Vmonth = MONTH(TODAY()) // Get the current month
VAR Previous = MAX('Calendar'[Date].[Year]) - 1
RETURN
CALCULATE(
TOTALMTD(
SUM('GLD_BON DAILY_FLASH_REPORT'[TotalFacialValue]),
'Calendar'[Date]
),
FILTER(ALL('Calendar'),
'Calendar'[Date].[Month] = Vmonth && 'Calendar'[MTD workday column] = workingdays && 'Calendar'[Date].[Year] = Previous)
)
/ 1000
By using MONTH(TODAY()) in the Vmonth variable, you're calculating the current month dynamically without relying on the slicer selection. This will ensure that your measure always works with the current month, regardless of the slicer's state.
Now, you don't need to manually select the current month in the slicer for this measure to work as expected.
OR Follw Link:
https://www.youtube.com/watch?v=JlVHsZUk1nc
https://www.youtube.com/watch?v=5dN4SqufENE
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
I get this error with this solution:
User | Count |
---|---|
12 | |
9 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
14 | |
9 | |
7 |