There are only 2 tables in my model
Calendar Table: Calendar table in Power BI generated through Power Query.
Events table: I am capturing events throughout the year in an Events table. But the problem is event details are by month, no date but just year and month. I concatenated the year and month and converted them into a date to tie it up with the datekey of the Calendar table.
The expected visual is as below and I am unable to display the weeks as shown below as the data is monthly. I somehow have to merge all the weeks into displaying the values under the month. is this possible?
Related
I am trying to find the Previous year sales for the same week in Power BI.I dont have any date column.
I have two table one is FACT Indicators table as shown below:
and one sales table( Fact Sales table):
I want to create one calculated field namely(Sales Previous Year) to show the previous year sales for the same week .
In 'Fact Indicators' table 'PY 52 week flag' filed shows if this week id is Previous year or not.
Week column shows the week number from 1 to 52 weeks .
Week Id shows the unique number per Market key.
'Market_Week Id Key' is the common joining key between FACT Indicators table and Fact Sales table
Please help me to find the formula for calculated field.I dont have the date field in my raw data
Every time you deal with anything related to dates, you will need to add what we call a date dimension. It will save you tons of headaches. Once you have it in you will be able to hook it into the creation of the calculated filed.
you can google power bi or ssas date dimension and find tons of information on it.
Yeah! I guess SQL Technical team can be a tough crowd.... Well! In this case, I would recommend bringing the Year into FactSales Table from Fact Indicator . You have two options here with physical relationship set up between Market Week Id Key in both tables you can build a calc column with
Year = CALCULATE(VALUES(FactIndicators[Year]))
or without relationship use LOOKUPVALUE on WeekId
Year = LOOKUPVALUE(FactIndicators[Year], FactIndicators[WeekId], FactSales[WeekId])
Sales Last Year calc colum :
SalesLastYear =
CALCULATE (
SUM(FactSales[SalesThisYear] ),
TOPN(1,
FILTER(
FactSales,
FactSales[Year] < EARLIER(FactSales[Year])
&& FactSales[Key] < EARLIER(FactSales[Key])
)
)
)
I have a report where I have sales data for end of every month. When I see the data in drop down ,I can see the end of month date , but when I have used slicer it shows the entire date range and not only the last day of the month. Is there any way in slicer through which I can just limit the date, so that only last day of month will be shown in slicer ?
If you have a dates table with a date field (named Date, in this case), you could add a column with this code: Table.AddColumn(PreviousStep, "EndOfMonth", each Date.EndOfMonth([Date]), type date)
I have a Power BI/DAX question. I'm looking to summarize my data by getting monthly transaction sums (including the year as well, i.e. MM/YY) and filtering them by individual account numbers. Here is an example:
I want to take that and make it into this:
I converted the dates to the format I want with this code:
Transaction Month = MONTH(Table[Date]) & "/" & YEAR(Table[Date])
Then got the total monthly sum:
Total Monthly Sum = CALCULATE(sum(Table[Transaction Amount]),ALLEXCEPT(Table, Table[Transaction Month]))
Now I'm trying to figure out how to filter the total monthly sum by individual account numbers. Just as a note - I need this to be a calculated column as well because I'll want to identify accounts that surpass individual account monthly spending limits. Can anyone help me with this?
Thanks so much!
When working with calendar dates, it pays to have a calendar table linked to the transaction table. In the calendar table you will have each date, from the start date of your relevant time period to the end of the time period relevant to your data. The columns of the calendar table can then contain calculations on that date like month number, month name, year, year-month key, transaction month (as the first day of the month for the date in that row), etc.
Next, connect the two tables in the data model by dragging the transaction date to the calendar date column.
Now you can build charts and report tables that group data by month without writing any complicated DAX. Just pull the field "transaction month" from the calendar table and the Total Sum measure from the transaction table into the field well of the visual.
That's what Power BI is all about.
Can you help me figure out how to display sales data by "WEEKS" in power BI visuals ? I have a calendar table and the date hierarchy is listed by Year, Quarter, Month and Day with no week option.the visual I'd like to create is the chart at the bottom of the image I have attached Thanks
You need to add in the Week to your calendar.
If your are using DAX there are a number of ways
To show the week number of the year use WEEKNUM
Week No = WEEKNUM(Table1[Date], 2)
For the start of the week in a date format use
Start of Week = 'Calendar'[Date] - WEEKDAY('Calendar'[Date],2) +1
The equivalent functions in Power Query are Date.WeekOfYear and Date.StartOfWeek
my issue is as below:
I hava a Calendar table with dates and Orders Table related to the Calendar table by DateID. I have slicer that allows user to choose month and year from a Calendar table so that the data will be shown only for the choosen month but on one bar chart i would like to show sum of orders by month (so month will be on X-axis) from Orders table not for one month but for the last 12 months where the last month is the one from the slicer. E.g. if user chooses 06-2107 from slicer then the bar chart should show orders data from 07-2016 till 06-2017. Obviously when the slicer and bar chart interact with each other i can see only one month.
I've tried to create a measure in DAX but I failed and the results are not what i expect. If the description is to messy i can provide the pbix file as an example