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.
Hi everyone!
I have a table with a row for each month and country, and a fake date that refers to the beginning of the month. I need a DAX formula to count the rows of the table (the months) that are selected by my slicers (year, month and country slicers), from the first month of the selection till the current one.
So, i.e. if I select Year: 2019, Month: March to July and a single country, I have to obtain this:
I also have a dimension date table related to this using the fake date. I use it to add information about month name, number etc.
I wrote this formulas using the dimDate to retrieve the fisrt day of the first month selected and the end of each month:
And they works fine (fist column is FirstDate and second is MonthEnd):
Using those measures, i tried to filter the table (or even a ALLEXCEPT of the table, keeping filtering on contries), choosing dates between FirstDate and MonthEnd, but it doesn't work.
Can someone help me whit this? Many thanks.
P.S. I already tried something like:
Solved! Go to Solution.
Check the screenshot, is this what you need. Please find formula
Cumm month =
var _min = minx(ALLSELECTED('Date'),('Date'[Date]))
return
CALCULATE(DISTINCTCOUNT('Date'[Month-Year]),FILTER(all('Date'),'Date'[Date]<=max('Date'[Date])&& 'Date'[Date]>=_min))
This calendar is attcahed with my facts.
As long as your table is joined with date table and date table has month, year, month year you can filter on any range. Similarly, if you take a country Slicer, It will filter on that.
What is that you are not able to achieve, require a formula.
I need to show this count for every level of the "month name" variable in the dim date. If May is the third selected month it should be written 3 on the May row. (If one country is selected. If I select two countries of course it's 6).
For some reasons, it compute the count as 1 for each month (with one selected country), it seems like the table is keeping the filter from the selected month name, even if I used a calculate on a ALLEXCEPT where selected month is not considered.
Check the screenshot, is this what you need. Please find formula
Cumm month =
var _min = minx(ALLSELECTED('Date'),('Date'[Date]))
return
CALCULATE(DISTINCTCOUNT('Date'[Month-Year]),FILTER(all('Date'),'Date'[Date]<=max('Date'[Date])&& 'Date'[Date]>=_min))
This calendar is attcahed with my facts.
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 |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |