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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Measure total wrong

Hello
I created a measure where total is coming wrong. I tried options shown in other posts with has one filter, not working. Any help?
My measure looks like
Calculate(datediff(firstdate(table1[field1], last date(table2[field2]),day),userrelationship(table2(field3],table1[field4]))
Thanks
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Yes,its measure total problem. When I added if( hasonefilter (table1[field1) at the front of created measure, total row goes away. For now I am okwith that

View solution in original post

8 REPLIES 8
Nimish
Regular Visitor

Hello

 

I got the measure total value wrong for one of a column in my Matrix Visual ( Column Name: CALC PRICE), which should be 0.22. Below is the matrix table and measure used to calculate that column

 

CALC PRICE = SUMPRICE * CALC

 

SUMPRICE = SUM ('TABLE'[PRICE])

CALC = DIVIDE ([SUMQTY , SUMQTYALL, BLANK())

SUMQTY = SUM('TABLE'[QTY]) & SUMQTYALL = CALCULATE(SUM('TABLE'[QTY],ALLSELECTED('TABLE'))

 

CAN ANYONE HELP IN HERE TO GET THE CORRECT COLUMN TOTAL!!

 

 

YearMonth NumberSite SKU QTYPRICECALC QTYCALCULATION (CALC QTY)CALC PRICECALCULATION (CALC PRICE)
20201A1234178500.130.23517817850/759000.03057310.235178*0.13
202011B1234178500.130.23517817850/759000.03057310.235178*0.13
20203C1234178500.130.23517817850/759000.03057310.235178*0.13
20206D123437000.320.0487483700/759000.01559950.048748*0.32
20207E1234186500.440.24571818650/759000.10811590.245718*0.44
TOTAL   759001.15  1.15 

@Nimish First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8

 

You might want to post this as a new post along with sample data, etc. This is a 3 year old thread that was closed.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler @edhans @amitchandak hi guys can you please help in here

edhans
Super User
Super User

You had a number of syntax issues and spelling errors for functions. Try this:

 

measure =
CALCULATE(
    DATEDIFF(
        FIRSTDATE( table1[field1] ),
        LASTDATE( table2[field2] ),
        DAY
    ),
    USERELATIONSHIP ( table2[field3], table1[field4] )
)

 

It may still not work and provide the results you want, but it is, at least, syntactically correct.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Thanks, it was my typo. My measure is working perfectly for each row. it’s just the total at bottom of table visual that is not showing right value. So I tried to add a part with Dax ,’has one filter’, But am not able to get the total row still right.

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Yes,its measure total problem. When I added if( hasonefilter (table1[field1) at the front of created measure, total row goes away. For now I am okwith that

I have no idea then. You'll have to provide data, and the expected result, for anyone to tell you why your measure isn't working.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.