March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I am trying to write a measure to create a dynamic visual. I have the following table below as a single table in my file. I want the user to be able to select a month. If the user selects June. Then I want previous month to be used in the measure (This would be May since this is the since 1 + the date rank gives the group of the previous month). Then I want the measure to count the number of rows where multiple filter conditions are met. I want to count rows where Dank rank =2, Status and Previous Status = "Not Normal" and where Type = "Task". So this would return a 1 because there is only one row where all conditions are met. But I want the measure to update based on what the user selects as the current month. If the user does not select a month, then I want to show blank for the measure. Right now, I am able to get the correct count, but when I group the visual by the "Group" column on the x-axis, I get the same number for each group rather than just the count for that specific group. (Table and current dax formula I have is below). Thank you for any help on this.
ID | Status | Date Rank | Previous Status | Month | Type | Group |
A | Normal | 3 | No previous | 24-Mar | Task | <0 |
B | Normal | 3 | No previous | 24-Mar | Task | 1 to 5 |
C | Not Normal | 3 | No previous | 24-Mar | Task | 1 to 5 |
D | Not Normal | 3 | No Previous | 24-Mar | Not Task | 11 to 15 |
A | Not Normal | 2 | Normal | 24-May | Task | 6 to 10 |
B | Normal | 2 | Normal | 24-May | Not Task | 6 to 10 |
C | Normal | 2 | Not Normal | 24-May | Not Task | 6 to 10 |
D | Not Normal | 2 | Not Normal | 24-May | Task | 6 to 10 |
A | Not Normal | 1 | Not Normal | 24-Jun | Task | 1 to 5 |
B | Not Normal | 1 | Normal | 24-Jun | Task | <0 |
D | Normal | 1 | Normal | 24-Jun | Task | <0 |
E | Normal | 1 | 24-Jun | Task | 1 to 5 |
Solved! Go to Solution.
You cannot do all this with only one table. You need to create a disconnected table for the month slicer, and then use a measure as the filter for your original table visual.
Hi @char23
Thank you very much lbendlin for your prompt reply. The solution you offer is reasonable. Let me add some details here.
Create a new month table.
Date =
DISTINCT(
SELECTCOLUMNS(
'Table',
"Month",
'Table'[Month].[Month]
)
)
Create a measure.
Measure =
var _selectMonth = SELECTEDVALUE('Date'[Month])
var _DateRank =
CALCULATE(
SELECTEDVALUE('Table'[Date Rank]),
FILTER(
ALL('Table'),
'Table'[Month].[Month] = _selectMonth
)
) + 1
var _tablecalculation =
CALCULATE(
COUNTROWS('Table'),
FILTER(
ALL('Table'),
'Table'[Date Rank] = _DateRank
&&
'Table'[Status] = "Not Normal"
&&
'Table'[Previous Status] = "Not Normal"
&&
'Table'[Type] = "Task"
)
)
RETURN _tablecalculation
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @char23
Thank you very much lbendlin for your prompt reply. The solution you offer is reasonable. Let me add some details here.
Create a new month table.
Date =
DISTINCT(
SELECTCOLUMNS(
'Table',
"Month",
'Table'[Month].[Month]
)
)
Create a measure.
Measure =
var _selectMonth = SELECTEDVALUE('Date'[Month])
var _DateRank =
CALCULATE(
SELECTEDVALUE('Table'[Date Rank]),
FILTER(
ALL('Table'),
'Table'[Month].[Month] = _selectMonth
)
) + 1
var _tablecalculation =
CALCULATE(
COUNTROWS('Table'),
FILTER(
ALL('Table'),
'Table'[Date Rank] = _DateRank
&&
'Table'[Status] = "Not Normal"
&&
'Table'[Previous Status] = "Not Normal"
&&
'Table'[Type] = "Task"
)
)
RETURN _tablecalculation
Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You cannot do all this with only one table. You need to create a disconnected table for the month slicer, and then use a measure as the filter for your original table visual.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
22 | |
19 | |
17 | |
9 | |
5 |
User | Count |
---|---|
37 | |
29 | |
16 | |
14 | |
12 |