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 moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I am looking to create a new measure in my power BI desktop that can help calculate the values from the table format I have stored as below -
If Product name is Blank, value should be from the "total value" column for that unique id and if product name exists OR price available as TRUE, then take values separately from the "value" column for each unique ID.
Can someone help with a DAX formula please.
Unique id | Product Name | Price Available? | Value | Total Value |
1 | Blank | FALSE | 20 | 40 |
1 | Blank | FALSE | 20 | 40 |
2 | ABC | TRUE | 30 | 65 |
2 | XYZ | TRUE | 35 | 65 |
3 | ABC 2 | FALSE | 10 | 10 |
Thanks!
Hi @Anonymous
Can you please show your ideal expected result for that dataset. It's not clear if you want to SUM values where more than 1 row qualify.
Cheers,
Phil
Hi @Phil_Seamark - in the example I have given I woudl like to see the result as 115 but using the values in cells highlighted in red - i.e. 40+30+35+10 (cells highlighted in red).
Thanks,
Hi @Anonymous
This calculated measure might be close. It generates 115 🙂
Measure = SUMX( DISTINCT('Table'), SWITCH( TRUE(), 'Table'[Product Name]="Blank",[Total Value] , 'Table'[Product Name]<> "Blank"|| [Price Available?]=true, [Value], 0 ) )
Hi @Phil_Seamark,
Thank you for your reply. It did not seem to work 😞 ..
i get an error (red font under the comma) after i choose the column for the Distinct function. Not sure what im doing incorrect.
Can one not use the normal IF, THEN, ELSE nomenclature for DAX formula?
I'm trying to do another multiple IF function as a calculated field, where I want to state that if filter is done on one column with say condition A, B or C in table one, it should then calculate the targets as a separate calculation based on table 2.
if i filter on condition A in table 1, i would want target to be sum of total target (from table 2) / 4 (quarterly)
if i filter on condition B in table 1, i would want the target to be sum of total target (from table 2) / 12 (monthly)
Can you kindly advise how I can achieve variable targets based on filter on another table?
Thank you again!
Ash
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
82 | |
82 | |
70 | |
49 |
User | Count |
---|---|
143 | |
123 | |
107 | |
61 | |
55 |