Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I am trying to retrieve [Days Between Incidents], grouped by the [Division]. Currently, I have [Days Between Incidents], without incorporation of the [Division]. I would like to be able to filter by Division for the report I create. I am having trouble with that, especially because I do not know the best solution.. whether to use measures or calculated columns.
This is what I currently have available:
Tables
Incidents - Shows Incident #, Date of the Incident, Date of Incident Filtered, and Division.
Previous Incident
DaysBTIncidents - Days Between Incidents, according to the Fiscal Date. This is the visualization to be shown.
FiscalCalendar - this table contains the Fiscal Dates, containg information such as Fiscal Month, Fiscal Year, Holiday Days, etc.
Relationships
I would like to obtain the [Days Between Incidents] measure, incorporating the Incidents[Division]... that means, for every division, there should be a new counter. Right now, when I filter by [Division], the numbers are the same for each, since the Previous Incident Date has no specified reference to the Division. What is the best way to do this? Are there DAX formulas that can be placed into a measure, optimizing performance? Or should I create a new table with calculated columns, that has every calendar date, and previous incident date per division?
Would really appreciate your advice!!
Solved! Go to Solution.
H @Anonymous,
You can try to use below measure to calculate previous incident date based on current incident index and division group:
Previous Incident Date =
VAR _currIncident =
SELECTEDVALUE ( 'Previous Incident'[Incidents] )
VAR _prevIncident =
CALCULATE (
MAX ( 'Previous Incident'[Incidents] ),
FILTER (
ALLSELECTED ( 'Previous Incident' ),
'Previous Incident'[Incidents] <= _currIncident
),
VALUES ( 'Previous Incident'[Division] )
)
RETURN
CALCULATE (
MAX ( 'Previous Incident'[Date] ),
FILTER (
ALLSELECTED ( 'Previous Incident' ),
'Previous Incident'[Incidents] = _prevIncident
),
VALUES ( 'Previous Incident'[Division] )
)
If above not help, please share some sample data for test and coding formula.
Regards,
Xiaoxin Sheng
H @Anonymous,
You can try to use below measure to calculate previous incident date based on current incident index and division group:
Previous Incident Date =
VAR _currIncident =
SELECTEDVALUE ( 'Previous Incident'[Incidents] )
VAR _prevIncident =
CALCULATE (
MAX ( 'Previous Incident'[Incidents] ),
FILTER (
ALLSELECTED ( 'Previous Incident' ),
'Previous Incident'[Incidents] <= _currIncident
),
VALUES ( 'Previous Incident'[Division] )
)
RETURN
CALCULATE (
MAX ( 'Previous Incident'[Date] ),
FILTER (
ALLSELECTED ( 'Previous Incident' ),
'Previous Incident'[Incidents] = _prevIncident
),
VALUES ( 'Previous Incident'[Division] )
)
If above not help, please share some sample data for test and coding formula.
Regards,
Xiaoxin Sheng
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 137 | |
| 102 | |
| 68 | |
| 66 | |
| 64 |