Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
In column 'OK' - # of month is a calculated column in excel with the following formula:
=IF(OR(O4="",DAYS($C$1,O4)>365),13,IF(YEAR(O4)=YEAR($C$1),MONTH($C$1)-MONTH(O4),12+MONTH($C$1)-MONTH(O4)))
I'm not sure sure I can create recreate this formula in Power BI... I can't find the equalivence for days in dax....
Thanks.
Solved! Go to Solution.
@PowerBIExplorer,
Please review the DAX in the PBIX file below.
https://1drv.ms/u/s!AhsotbnGu1Nok0Ck5EKND2-5SLIk
Regards,
Lydia
Hey,
it's little bit difficult for totally understand your requirement from the screenshot and your Excel Formula. It would be really helpful if you created some sample data in a PBIX file, upload this file to onedrive or dropbox and share the link 😉
But nevertheless maybe this gets you started (I assume you want to create a calculated column):
Your Excel O4 = "" can be translated to DAX like so ISBLANK('tablename'[ColumnameFromO4])
Assuming that the data type of your column O4 is something like datetime or date than you can use the DAX formulas YEAR('tablename'[ColumnameFromO4]), MONTH('tablename'[ColumnameFromO4])
You can use DATEDIFF (https://msdn.microsoft.com/en-us/query-bi/dax/datediff-function-dax) to calculate the duration between two dates for a certain unit like days
Overall I would suggest to use the DAX formula SWITCH to avoid cluttered nested if statements like so:
SWITCH( TRUE() ,your first condition, 13 ,your 2nd condition, ...
,maybe a something else :-) )
Hopefully this gets you started
Regards
Tom
Thank you, here is a sample dataset of what I'm working with.
https://app.box.com/s/ckaqvj9maiy5gt6jdsqy8h51mwgkr3uq
Columns J and K are the columns I need to replicate in Power BI as calculated columns.
I'm not sure to input the data for "Measures as of'' into Power bi since it's not a whole column. Maybe I can replace the cell in the formula with the actual dates, but I find that tedious if I need to update it everytime I update the excel sheet.
@PowerBIExplorer,
Please review the DAX in the PBIX file below.
https://1drv.ms/u/s!AhsotbnGu1Nok0Ck5EKND2-5SLIk
Regards,
Lydia
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |