Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I need help in creating two measures as below:-
Measure 1
Sum (Cost + tax1 + tax 2) Divide by 100 Multiply by 15
Percentage Value should be returned as result
Measure 2
Sum (Cost + tax1 + tax 2) *15% = Tax 3
Return
If Matches True else False
Data
Cost | Tax1 | Tax2 | Tax3 |
-100 | 0 | 0 | 0 |
-90 | 0 | 0 | 0 |
-84 | -101.38 | 0 | -4.22 |
-80 | -500 | 0 | 0 |
-80 | -50 | -210 | 0 |
-80 | -40 | -40 | 0 |
220 | 480 | 215 | 0 |
221 | 0 | 0 | 0 |
221 | 0 | 0 | 0 |
221 | 29.07 | 0 | 11.06 |
221 | 0 | 0 | 11.07 |
223 | 35 | 62.45 | 0 |
224 | 34 | 0 | 11.19 |
224 | 0 | 0 | 0 |
224 | 26 | 0 | 0 |
225 | 0 | 0 | 11.23 |
Solved! Go to Solution.
Download sample PBIX file with the following code
OK, for Measure1
Measure1 = SUMX('DataTable',[Cost]+[Tax1]+[Tax2])/10000*15
Measure2
Measure2 = VAR _Tot = SUMX('DataTable',[Cost]+[Tax1]+[Tax2])*0.15
RETURN
SWITCH(
TRUE,
_Tot = SELECTEDVALUE('DataTable'[Tax3]), True,
False
)
Giving this
Regards
Phil
Proud to be a Super User!
Download sample PBIX file with the following code
OK, for Measure1
Measure1 = SUMX('DataTable',[Cost]+[Tax1]+[Tax2])/10000*15
Measure2
Measure2 = VAR _Tot = SUMX('DataTable',[Cost]+[Tax1]+[Tax2])*0.15
RETURN
SWITCH(
TRUE,
_Tot = SELECTEDVALUE('DataTable'[Tax3]), True,
False
)
Giving this
Regards
Phil
Proud to be a Super User!
Both of those measures calculate the same thing.
This bit of your code:
If Matches True else False
What are you trying to do there? Compare the two measures?
Regards
Phil
Proud to be a Super User!
Hi @PhilipTreacy - With Measure 1 I need to return the percentage value whereas with measure 2 I need the result to match with tax 3 and return true or false. Thanks
Result
Measure 1
Cost | Tax1 | Tax2 | Measure 1 |
-100 | 0 | 0 | -15.00% |
-90 | 0 | 0 | -13.50% |
-84 | -101.38 | 0 | -27.81% |
Measure 2
Cost | Tax1 | Tax2 | Tax3 | Measure 2 |
-100 | 0 | 0 | 0 | FALSE |
-90 | 0 | 0 | 0 | FALSE |
-84 | -101.38 | 0 | -4.22 | FALSE |
-80 | -500 | 0 | 0 | FALSE |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
97 | |
65 | |
45 | |
39 | |
31 |
User | Count |
---|---|
164 | |
111 | |
61 | |
53 | |
38 |