Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I have a data of 3 years with 12 Periods each. I need to count the redlights categorized by YES/NO per year and period:
I have my initial DAX:
@RJMonteza Maybe:
Measure = COUNTROWS( FILTER( 'REDLIGHT', [VALID OE ERROR (Y/N?)] = "YES" ) )
Hello Greg,
I also need to filter the date and year. I need to count how many YES in a perod in this year.
Thanks!
@RJMonteza I assumed those would just be part of the visual.
Nope, I need to count all the valid redlights (YES) per month of the year. Right now, my DAX is calculating all the valid redlights for those 3 years. Example: Sum of 2021, 2022, and 2023 of PD1 = RL count. Which is not correct, I need it to look like this up to perod 12:
2021 | 2022 | 2023 |
PD 1 = 2 | PD 1 = 0 | PD 1 = 1 |
PD 2 = 1 | PD 2 = 2 | PD 2 = 0 |
PD 3 = 0 | PD 3 = 1 | PD 3 = 1 |
@RJMonteza Not sure I am completely following but you can do this:
Measure 2021 = COUNTROWS( FILTER( 'REDLIGHT', [VALID OE ERROR (Y/N?)] = "YES" && [YEAR] = "2021" ) )
Hmm... Can we have it apply to all years instead of filtering just 1 year, then per period, then countrows. I am seeing that there is a need to use VAR, but I'm not sure how..
@RJMonteza OK, so like this?
Measure 2021 =
VAR __Table =
SUMMARIZE(
FILTER( 'REDLIGHT', [VALID OE ERROR (Y/N?)] = "YES" ),
[YEAR},
[PERIOD],
"__Count", COUNTROWS( 'REDLIGHT' )
)
VAR __Result = SUMX( __Table, [__Count] )
RETURN
__Result
Note that sample data and expected result would make this FAAARRRR more easy to figure out what you are going for here.
I'm having this as a result:
The result I need is a a single digit one up to PD 8 only, since we only have a data until PD 8. I need this to be:
PD 1 = 1
PD 2 = 1
PD 3 = 0
PD 4 = 1
PD 5 = 1
etc.
Note: The redlight table is another table from this one.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
12 | |
9 | |
9 | |
9 |
User | Count |
---|---|
21 | |
14 | |
14 | |
13 | |
13 |