I have a report that shows me the sales for each department for the current year. This is visualized in a matrix with.
The sales table contains a date column that is linked to a simple calendar table that contains information like week, month, year etc.
Now I would like to count the number of weeks where
Strong = Sales above 500k
Extraordinary = Sales above 750k
Moderate = Sales below 500k
How is this possible by using a DAX Measures?
Hopefully this works without sample data because I right now have just access to my cell phone.
Related
I have a measure that calculates shortage dates of a column of items. How do I create a column/measure that outputs a 1-5 ranking based off how closely the shortage date of those items is with the current date. So a 10 would be the closest shortage dates. 5 = within one month, 4 = within two months, ... etc.
I have the following dataset:
The extrato_fi table has a list of companies referenced by CNPJ_FUNDO and it's name DENOM_SOCIAL. The Informes Diários table has the date (dd/MM/yyyy) and the VL_TOTAL which means the amount of money the company have in that day.
So, I'd like to calculate the profitability in % and the formula is:
Sum of VL_TOTAL of all dates / VL_TOTAL of the first date
It must be possible to filter by date and/or CNPJ_FUNDO in order to know the profitability of a companies or companies in any date or in an interval of dates (See the filters image below. Ano means Year, Mês means Month)
It must be possible to drill down by year, month or day in any table or graph
How can I achieve that?
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 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.
I have a report on Power BI where data comes from a tabular cube. The DAX expressions are made in the cube. When drilling down in Power BI and comparing results to the original numbers there is a slight difference. Power BI calculates the week figures as monday - sunday, but I want it to show from sunday - saturday
Initial code:
IF(ISBLANK([Revenue]), BLANK(), CALCULATE([Revenue],SAMEPERIODLASTYEAR('Date'[Date]),ALL('Date'[Date])))
The date table in cube contains columns [SortFiscalWeek], [SortFiscalMonth], [SortFiscalYear], [Week Commencing],Fiscal Week Number.
Week Commencing is in accordance to Sunday (being the week commence date) - Saturday.
The sort fiscal columns start as 1 from years ago and end to whichever number it is today based on today's date.
I added Fiscal Week Number as I thought it might be helpful and tried using it as Test New Users LY = IF(ISBLANK([New Users]),BLANK(),CALCULATE([New Users],SAMEPERIODLASTYEAR('Date'[Date]),FILTER(ALL('date'),'Date'[Fiscal Week Number]='Date'[Fiscal Week Number]&&'Date'[YearInt] = 'Date'[YearInt]-1)))
EDIT
In Power BI I am using a Clustered Column Chart with Date Hierarchy in the Axis and Revenue in the Value. On week level it sums the Revenue as Monday-Sunday and not Sunday-Saturday. Hope this clears up some doubt as to how i am using the data in Power BI
Can anyone help?
If I understood well, I had the same problem, I created a calculated column giving me the name of the month, like this:
MonthName = SWITCH(DimDate[Month], 1,"gennaio",2,"febbraio",3,"marzo",4,"aprile",5,"maggio",6,"giugno",7,"luglio",8,"agosto",9,"settembre",10,"ottobre",11,"novembre",12,"dicembre","altro")
then I needed to order the month by month number, so to do this you need to select your calculated column, and then go to the tab Modelling>Sort by column, in this menu you can choose on which field of the table you order the selected field.
Hope that helps.