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
Hello Everybody, how are you?
ı have question about writing a row context dax in a ıf clause .
ı want to wrıte this query(*1) ınsıde of this query(*2). how to do that do u think?
*1:
IF A[X]="H"
THEN A[Y]*A[Z]*(-1)
ELSE IF A[X]="S"
THEN A[Y]*A[Z]
ELSE 0
-- A= TABLE NAME. X,Y,Z COLUMN NAME.
NOTE: I TRYED SWITCH FX BUT IT DOESNT WORKED.
*2:
Hello @Trist
You can try this
Measure 1 =
IF (
ISBLANK ( [Day] ),
BLANK (),
IF ( A[X] = "H", A[Y] * A[Z] * ( -1 ), IF ( A[X,] = "S", A[Y] * A[Z], 0 ) )
)
SWITCH will work. You shouldn't name your measure VALUES - that is a function in DAX. Call it something else.
New Measure =
IF(
ISBLANK( [Day] ),
BLANK(),
SWITCH(
TRUE(),
A[X] = "H",
A[Y] * A[Z] * ( -1 ),
A[X,] = "S",
A[Y] * A[Z],
0
)
)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingMarch 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 |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |