Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi can someone help me to cretae a multiple if statement column calculation in Dax?
= IF('Start Date'[Length of Tenure Absolute]<13,12,0), IF(AND('Start Date'[Length of Tenure Absolute]<25, 'Start Date'[Length of Tenure Absolute]>12),24,0),
IF and so on until 60 months
thanks!
Hi @ballist1x,
I have make a demo which you could have a try.
column = IF ( 'Start Date'[Length of Tenure Absolute] < 13, 12, IF ( 'Start Date'[Length of Tenure Absolute] > 12 && 'Start Date'[Length of Tenure Absolute] < 25, 24, IF ( 'Start Date'[Length of Tenure Absolute] > 24 && 'Start Date'[Length of Tenure Absolute] < 49, 48, IF ( 'Start Date'[Length of Tenure Absolute] > 48 && 'Start Date'[Length of Tenure Absolute] < 61, 60, 0 ) ) ) )
You could change the data in the condition as yours in this format.
In addition, you could make a reference of this similar post.
If you need additional help please share some data sample. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)
Best Regards,
Cherry
Hi i went for this in the end:
Less than 12 months = IF('Start Date'[Length of Tenure Absolute]<13,1,0)
12 Month Margin = (calculate(SUM('H12015'[Margin (£)]), (FILTER(ALL('Start Date'),('Start Date'[Length of Tenure Absolute]>=1 && ('Start Date'[Length of Tenure Absolute]<=12))))))/Sum('Start Date'[Less than 12 months])
then
Less than 24 months = IF(AND('Start Date'[Length of Tenure Absolute]<25, 'Start Date'[Length of Tenure Absolute]>12),2,0)/2
24 Month Margin = (calculate(SUM('H12015'[Margin (£)]), (FILTER(ALL('Start Date'),('Start Date'[Length of Tenure Absolute]>=12 && ('Start Date'[Length of Tenure Absolute]<=24))))))/Sum('Start Date'[Less than 24 months])
and do on, is this correct?
Hey,
I assume you are looking for the DAX function SWITCH(...)
Here is a example how you can leverage SWITCH with the boolean expression TRUE
Read until you find the answers from @greggyb, for now the last post links to more articles advocating for SWITCH
Hope this is what you are looking for
Tom
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
115 | |
112 | |
105 | |
95 | |
58 |
User | Count |
---|---|
174 | |
147 | |
136 | |
102 | |
82 |