Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don'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.

Reply
gauravnarchal
Post Prodigy
Post Prodigy

Measure help required

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

 

CostTax1Tax2Tax3
-100000
-90000
-84-101.380-4.22
-80-50000
-80-50-2100
-80-40-400
2204802150
221000
221000
22129.07011.06
2210011.07
2233562.450
22434011.19
224000
2242600
2250011.23
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @gauravnarchal 

 

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

mess.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
PhilipTreacy
Super User
Super User

Hi @gauravnarchal 

 

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

mess.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


PhilipTreacy
Super User
Super User

Hi @gauravnarchal 

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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


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

 

CostTax1Tax2Measure 1
-10000-15.00%
-9000-13.50%
-84-101.380

-27.81%

 

Measure 2

CostTax1Tax2Tax3Measure 2
-100000FALSE
-90000FALSE
-84-101.380-4.22FALSE
-80-50000FALSE

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.