Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
Can someone help me with converting the following Excel-formula to Dax?
=IF(ISBLANK(F2);IF(YEAR(E2)=2021;(-MONTH(E2)+12)/12;1);MONTH(F2)/12)
Any help is greatly appreciated!
Regards,
sondi
Hi @Anonymous ,
@amitchandak is right if you want to create columns in power bi. I make some additions. If you want create measure, the parameter of ISBLANK() can not be [field name] directly. Use selectedvalue( 'table'[fied name] ) or max( 'table'[fied name] ) replace "F2", so as function MONTH(),YEAR(). Selectedvalue() means return current row's value.
For example, i have one table named test.
ID | start date | end date |
001 | 2/1/2022 | 2/15/2022 |
002 | 2/2/2022 | |
003 | 2/3/2022 | 2/16/2022 |
And measure
Measure =
IF(
ISBLANK( SELECTEDVALUE( 'Table'[end date] ) ),
IF(
YEAR( SELECTEDVALUE( 'Table'[start date] ) ),
( - MONTH( SELECTEDVALUE( 'Table'[start date] ) + 12 ) ),
1
),
MONTH( SELECTEDVALUE( 'Table'[end date] ) ) / 12
)
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , This should work with column name in power bi
F(ISBLANK([F]);IF(YEAR([E])=2021;(-MONTH([E])+12)/12;1);MONTH([F])/12)
E and F should be date
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
73 | |
72 | |
39 | |
31 | |
26 |
User | Count |
---|---|
97 | |
87 | |
43 | |
40 | |
35 |