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
atul_03
Regular Visitor

TOTAL not working

Hi Everyone,

Total is not working for my Last Year measure.I've attached snip for the reference.
Individual values are correct but in Totals the value is wrong.

 

Sales LY Week =
VAR LY =Calculate( [Sales]
 ,Filter(ALL('Calender'), 'Calender'[DWY] = Max( 'Calender'[DWY])-1 && 'Calender'[Region]=MAX('Calender'[Region])))
RETURN
LY

atul_03_0-1674369308366.png

 

 

 

Thanks!!

 

1 ACCEPTED SOLUTION

Hi @atul_03 ,

How did you set your matrix visual? Could you please share the Fields setting? You can create another new measure as below and put this new measure to replace the original measure [Sales LY Week] onto the matrix visual. Later check if it can return the correct total values...

New Measure =
SUMX (
    GROUPBY (
        'Table',
        'Table'[Region],  //The field from Rows field of your matrix
        'Table'[fieldname],//The field from Rows field of your matrix
        'Table'[Category] //The field from Rows field of your matrix
    ),
    [Sales LY Week]
)

yingyinr_2-1674543308087.png

yingyinr_1-1674543137224.png

In addition, you can refer the following links to try to solve your problem...

Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

Dax for Power BI: Fixing Incorrect Measure Totals

 

If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
atul_03
Regular Visitor

@Mikelytics 

Sales LY Week =
VAR LY =Calculate( [Sales]
 ,Filter(ALL('Calender'), 'Calender'[DWY] = Max( 'Calender'[DWY])-1 && 'Calender'[Region]=MAX('Calender'[Region])))
RETURN
LY
 

@atul_03 

Why do you have a Region column in the Calendar table? Looks very uncommon from the begin with and it might be recommended to reqrite the measure in genereal. But hard to say without knowing the whole datamodel.

 

Can you please try the following.

Sales LY Week =
VAR LY =
SUMX(
   VALUES('Calender'[Region]),
   CALCULATE( 
     [Sales]
     ,Filter(ALL('Calender'), 'Calender'[DWY] = Max( 'Calender'[DWY])-1 && 'Calender'[Region]=MAX('Calender'[Region]))
   )
)
RETURN
LY

 

If this does not work then please share the general setup with sample data so that we might be able to build it propertly from the beginning.

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Hi Mike,

 

Above measure is not working .Actually every region has it own calendar to calculate LY Sales, which based upon Week number and Day of Week. I have appended all region calendar into one calendar and created below keys .Please check below model.

 

atul_03_0-1674375193698.png

 

uae datekey =
'Data Set'[accountingDate]&'Data Set'[region]
uae key =
'Calender'[Date]  & 'Calender'[Region]
 
Last Year sales values are comming correct , just Total is not is incorrect 

Hi @atul_03 ,

How did you set your matrix visual? Could you please share the Fields setting? You can create another new measure as below and put this new measure to replace the original measure [Sales LY Week] onto the matrix visual. Later check if it can return the correct total values...

New Measure =
SUMX (
    GROUPBY (
        'Table',
        'Table'[Region],  //The field from Rows field of your matrix
        'Table'[fieldname],//The field from Rows field of your matrix
        'Table'[Category] //The field from Rows field of your matrix
    ),
    [Sales LY Week]
)

yingyinr_2-1674543308087.png

yingyinr_1-1674543137224.png

In addition, you can refer the following links to try to solve your problem...

Why Your Total Is Incorrect In Power BI - The Key DAX Concept To Understand

Dax for Power BI: Fixing Incorrect Measure Totals

 

If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks its working

Mikelytics
Resident Rockstar
Resident Rockstar

Hi @atul_03 

,

 

Can you please add the measure you used?

 

Best regards

Michael

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

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.