The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello Power BI community,
I need to subtract a value of 17.11 from a specific measure I have within a table for a specific month and document number, but I do not want this value subtracted from other measures or months / document numbers that I have within the same DAX formula.
Below is a copy of my DAX formula:
Solved! Go to Solution.
Hi @sergiodefreitas ,
According to your description, you want to subtract 17.11 in a specific case, you can see in your measure that you subtracted the value from your measure under your judgment. But you say "also subtracts the value of 17.11 from the other month which I have in my formula, which is August".
This situation needs to be combined with the fields you place on top of the visual.
The measure is calculated as the result under the current filter context, and you can use your measure:
CALCULATE([DevLIQ-IVA]-17.11, 'wgcDocLinhas'[Serie] IN { 21 }, 'wgcDocLinhas'[Data].[ Mês] IN {"julho"}, 'wgcterceiros'[TipoDoente] IN { "GRUPO" }, 'wgcDocLinhas'[Numdoc] IN { 16 }, 'wgcDocLinhas'[Tipodoc] IN { "NC" })
Test in your visual that the value he returns is the same as you expected.
Refer this docunment , you can store the result of an expression as a named variable, which can then be passed as an argument to other measure expressions. Once resultant values have been calculated for a variable expression, those values do not change, even if the variable is referenced in another expression.
And for your needs, you can also provide your sample data, please pay attention to protect private data, and give us the sample data you want in the form of a table, so that we can better help you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @sergiodefreitas ,
According to your description, you want to subtract 17.11 in a specific case, you can see in your measure that you subtracted the value from your measure under your judgment. But you say "also subtracts the value of 17.11 from the other month which I have in my formula, which is August".
This situation needs to be combined with the fields you place on top of the visual.
The measure is calculated as the result under the current filter context, and you can use your measure:
CALCULATE([DevLIQ-IVA]-17.11, 'wgcDocLinhas'[Serie] IN { 21 }, 'wgcDocLinhas'[Data].[ Mês] IN {"julho"}, 'wgcterceiros'[TipoDoente] IN { "GRUPO" }, 'wgcDocLinhas'[Numdoc] IN { 16 }, 'wgcDocLinhas'[Tipodoc] IN { "NC" })
Test in your visual that the value he returns is the same as you expected.
Refer this docunment , you can store the result of an expression as a named variable, which can then be passed as an argument to other measure expressions. Once resultant values have been calculated for a variable expression, those values do not change, even if the variable is referenced in another expression.
And for your needs, you can also provide your sample data, please pay attention to protect private data, and give us the sample data you want in the form of a table, so that we can better help you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
14 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
28 | |
18 | |
13 | |
7 | |
5 |