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 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!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
40 | |
32 | |
29 | |
12 | |
11 |