The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I have the following data in "Plans" Table
MarketId | Month | Year | Requests |
34 | 12 | 2020 | 11 |
34 | 4 | 2020 | 6 |
34 | 2 | 2020 | 12 |
34 | 8 | 2020 | 18 |
34 | 9 | 2020 | 20 |
34 | 4 | 2020 | 14 |
And in the "Requests" Table
Created | MarketId |
2020/09/03 | 34 |
2020/12/04 | 34 |
2020/12/10 | 35 |
I already have a relationship from both to a separeted table for the market names but I get the wrong results. the data in the table is more but for this example I tried to limit the data just to show.
So, how can I get the number of Requests from table "Plans" based on the month/year and the market? in this case the sum value I get should be 31 for marketid "34"
Solved! Go to Solution.
@rssilvaba , Second table has date, The first on can date
Date = Date([year], [Month],1)
I am nor sure how they are related now. But they can either join on the date columns . or join to common date table .
Can you share data model and expected output
@rssilvaba , Second table has date, The first on can date
Date = Date([year], [Month],1)
I am nor sure how they are related now. But they can either join on the date columns . or join to common date table .
Can you share data model and expected output
Thanks @AllisonKennedy, Creating a calendarauto table and using @amitchandak solution worked for me. the only drawback for that is if we need to drilldown to the days, but we not doing that with this report so it should be fine.
Thanks all.
Glad it's working! You should be able to get it working for days if/when needed with a DimDate table, so let us know how you get on if that becomes a requirement.
https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Hi @AllisonKennedy I tried to reference that columns to the created date. But I am not sure I know how. If I try to refer to a diferent table column as in the DAX below using calculate and filter it does not allow me to refer to a diferent column.
To @lkalawski, sorry I am not that experienced with DAX or PowerBI so I have no idea how I can intersect the data to get the matches I need. If you can point me to some examples I can try to apply them to my problem.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Hi @rssilvaba
If you only have a relationship to market name, then there is no date differentiation, so you see more values than you should.
Proposed solutions:
1. You can create a concatenate key in both tables which will consist of market, year and month - example: 34202012. And then you will join both tables by these keys.
2. If you have a relation, you need to create a measure:
Calculate (Sum (Plans [Requests]), MONTH (Created) = Plans [Month], YEAR (Created) = Plans [Year])
_______________
If I helped, please accept the solution and give kudos! 😀