Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
I'm new to DAX. Kindly help me on this.
If i use zero for else statement, I'm getting error as insufficient memory.
I want to make the below dax faster and total to be visible.
DAX =
IF (
SUM ( Counter_flag ) = 1,
CALCULATE ( DISTINCTCOUNTNOBLANK ( ColumnName ),
KEEPFILTERS( 'table[Counter_flag] = 1 )
)
DAX =
VAR _t1 = SUM ( Counter_flag )
VAR _t2 = SUMX(DISTINCT( ColumnName ),1)
RETURN
IF (
_t1 = 1,
CALCULATE (_t2,
KEEPFILTERS( 'table[Counter_flag] = 1 )
)
You can probably re-write your DAX to not use the IF statement, by instead using a FILTER statement in your CALCULATE.
Like this:
CALCULATE(
DISTINTCOUNTNOBLANK([ColumnName]),
FILTER(
'table',
SUM('table'[Counter_flag]) = 1
)
)
This one is taking too long to load. (30 million rows are there)
you may try a combination of SUMX and CALCULATETABLE to acheive your goal and potentially improve performance.
SUMX (
CALCULATETABLE ( VALUES ( [Counter_flag] ), [Counter_flag] = 1 ),
SUM ( [Counter_flag] )
)
Hi @Keegan_Patton - Do you mean this ?
CALCULATE(
DISTINTCOUNTNOBLANK([ColumnName]),
SUMX (
CALCULATETABLE ( VALUES ( [Counter_flag] ), [Counter_flag] = 1 ),
SUM ( [Counter_flag] )
)
)
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
User | Count |
---|---|
92 | |
92 | |
84 | |
80 | |
49 |
User | Count |
---|---|
146 | |
137 | |
109 | |
68 | |
55 |