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.
There are two measures, A and B, that use different data sources. I want to use these measures in a larger measure, C. In C, I want the logic to be, for the current month (month to date), use measure A, otherwise, use measure B.
I know there is MONTH(NOW()) which returns the current month, but I don't know how to use a second variable that keeps track of the month to compare it to this month to date.
So something of the sort for measure C:
IF (var == MONTH(NOW()):
[A]
ELSE
[B]
Need help figuring out what to set var to. Measure C will be displayed in a visual card as a numerical value and has a date history, slice-able by month.
Based on your description, you need to create a calendar table as a bridge table. Use the date in the calendar table as a condition, and then create an IF statement. See if this works
Hi,
You should ideally build a Calendar Table and from there build 2 slicer visuals - Year and Month name. Select a certain Year and Month name. Write this measure
Measure C = if(and(selectedvalue(Calendar[Year])=2021,selectedvalue(Calendar[Month name])=format(today(),"mmmm")),[Measure A],[Measure B])
Hope this helps.
"I want to use these measures in a larger measure"
That is considered bad practice. Rather, write each measure individually.
Use Calculation Groups for what you are trying to achieve.
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |