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
prabhuk
Helper I
Helper I

Error in matrix table

Hello,

can you help in identifing the error in the attached file. when i add reagion along with sales and commit table i am getting error.

https://www.dropbox.com/s/yly9bouar7rjfz5/BI%20File.pbix?dl=0

1 ACCEPTED SOLUTION

Hi,

Download the PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
prabhuk
Helper I
Helper I

Hi,

I have adeed calender table and still i have issue in previsou year calculations.

I have created two table one is based on region and another is on date(week)

 

https://www.dropbox.com/s/nypm1039dlcm1n4/BI%20File.pbix?dl=0

Hi,

Download the PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
parry2k
Super User
Super User

@prabhuk I know @mahoneypat  gave the solution without a date table but I will never go that route Make a habit to add a date dimension in your model and perform all time intelligence based calculations based on this dimension. There is a reason why it needs to be in the model.

 

Just my 2 cents.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

mahoneypat
Employee
Employee

I agree you should add a Date table to your model.  FYI that you can do your calculation without one (but you really should add one).  Here is an example.  Also, FYI that you don't need to wrap all your measures in CALCULATE, only when you need to change the evaluation context (like your previous year calculations).

 

FY20 2 =
VAR vThisYear =
    YEAR (
        TODAY ()
    )
RETURN
    CALCULATE (
        SUM ( Sales[Sales] ),
        FILTER (
            ALL ( Sales[DATE] ),
            YEAR ( Sales[DATE] ) = vThisYear - 1
        )
    )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Ashish_Mathur
Super User
Super User

Hi,

Your tables and relationships are not properly set up.  You should create a Calendar Table and build a relationship from the Date columns of the Budget and Sales table to the Date column of the Calendar Table.  The region column of the Budget and Sales table should also be connected to the Region column of the Region table.  There should be no relationship between the Budget and Sales table.  Any time period related slicer (Year/Month Name) should be dragged from the Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
parry2k
Super User
Super User

@prabhuk for any date-related calculations, you must add a date dimension in your model, and to add one, you can look at my post here.

 

once this table is there, change all your measures to use date from this new date table instead of from your sales table and it will all work.

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.