How can I display months without no data? - powerbi

I follow the following blog http://sqljason.com/2018/03/display-last-n-months-selected-month-using-single-date-dimension-in-powe... in order to display Display Last N Months & Selected Month using Single Date Dimension in Power BI.
I've an issue when trying to display month-year when there is no data in the fact table sales.
I did modification: https://1drv.ms/u/s!Amd7BXzYs7AVg3xJ1MKPYI_PIw3z
How to show to show for example October, november and december 2015 as an example?

I downloaded your PBIX file and looked through it.
I am unsure what you exactly want to see, because your report has a few quirks in it.
I'll try to sum them up:
You have a 'select month' drop down menu ánd a slider for selecting the number of months (As 'sales for last x months). This doesn't work. Since you now need to manually select the wanted months in the drop down menu with CTRL+Click (On each month) ánd you need to use the slider.
Next to that, your calculations seem to be wrong. If I only select Dec-16 I get 70. If I select Nov-16 and Dec-16, the sales in Dec-16 suddenly become 70 and Nov-16 takes over. If I select until July-16, July-16 gets 70 and Dec-16 gets 120.. I don't know if this is how you want it but it looks like strange behaviour.
A good tip for measures. If you sum, divide or do any calculation. End with +0. That way you wont see (Blank) but 0. E.g.
Sales (Selected Month) = SUM(Sales[Sales]) + 0
Also, you have made a small date table, which is good. But you don't use this consistently through your report. For selecting months you use the date table and for the graph you use the date in the sales table. It is better to use the date table for dates, since that is it's sole purpose.

Related

Comparing data for a month across a choice of 2 different years using slicers in Power BI

I am trying to create a tab in Power BI that includes a Year to Year Comparison for a month using a slicer on a date hierarchy, but I'd like the user to be able to chose which years are being compared (for future-proofing the report). This involves using 3 slicers on the report - 2 for the choice of 2 years, and 1 for the month of interest. I haven't yet found a way to get the data to show up for the graph I want.
I created a mock page that displays the type of report I'm looking for, but it only has a month slicer, and utilizes built-in page filters to constrain the years:
Reference image for what I'd like the graph to look like
What I'd like to create is a page with the filter options shown here, but it's not outputting any data, much less anything like the first graph (unless I have both year slicers to be the same):
Has the slicer options I want, but data doesn't show
I've looked into including some Time-Intelligent DAX functions, but from what I can tell, nothing seems to be an obvious solution for what I'm trying to do.
Start with two measures - one each for year 1 and 2 - to show the data for those years, and two unrelated slicer tables driving the year selection. Each measure can then pick up its year value (via SELECTEDVALUE) to use for data filtering.

Using multiple IF/AND statements to look at a query table and display a Yes/No result

I'm attempting to write a formula for excel that will look at 3 different columns of data in a query table that I'm pulling from my teams sharepoint site. I'm trying to have a Yes/No result given.
The formula I've written so far is
=IF(AND(ISTEXT(Governance_Master_List__2[Is the check c]="Yes")+(AND(ISTEXT(Governance_Master_List__2[Merged Month and Year Due]="January 2023")+(AND(ISTEXT(Governance_Master_List__2[Frequency]="Weekly")))))),"Yes","No")
So, In this example I want the formula to look at [Is the check c] for a "Yes", then Look at the [Merged month and year due] for January 2023, and then look at [Frequency] for "Weekly", and if all 3 of those are met to show the result of Yes onto another worksheet.
So far the formula isn't throwing an error when making it, but it only returns the No result, even when I ensure that all the Weekly, January 2023 entries are showing as Yes.
I'm very new to excel in terms of formulas and am learning as I go. I feel like, because the refernce query table i'm looking at has tons of different values (eg, the frequency has weekly, 6 monthly, monthly, quarterly etc and that there are 12 months to choose from) that the formula is stopping because its looking at and not ignoring those other options, hence the constant false result.
I've tried the following variations with no result..
=IF(AND(ISTEXT(Governance_Master_List__2[Is the check c]="Yes")(AND(ISTEXT(Governance_Master_List__2[Merged Month and Year Due]="January 2023")(AND(ISTEXT(Governance_Master_List__2[Frequency]="Weekly")))))),"Yes","No")
=IF(AND('Imported data'!C1:C200="Weekly")+(AND('Imported data'!E1:E200="January 2023")+(AND('Imported data'!H1:H200="Yes"))),"Yes","No")
=IF(AND('Imported data'!C1:C200="Weekly")(AND('Imported data'!E1:E200="January 2023")(AND('Imported data'!H1:H200="Yes"))),"Yes","No")
The output excel sheet is to show our quarterly compliance reporting, i'm simple trying to automate the process of entering the data into that report, as the teams use a sharepoint list to enter their compliance tasks.
Anyone have a suggestion on how I can get this working? Eventually it'll be used to populate a number of different yes/no report cells based on the relevant month and frequency of the check.

PowerBI measure calculates average incorrectly - why?

To preface this, I'm fairly experienced in Excel and VBA but new to PowerBI and more than a bit confused.
I have a flat table with a [creationdate]-, [Prio] (Priority (1,2,3)) and a calculated [Days Open] column, among many irrelevant others. I need to create a chart that displays the average days a case was open by priority of the case.
To display the average "days required" per (opening-) month for the past 18 months, I created the following measure:
Prio 1 = CALCULATE(AVERAGE('SourceName'[Days Open]),'SourceName'[Prio]=1)
Then I used that as a value, and used the [creationdate] as the x-axis. (Later I changed the x-axis to a new date table linked to [creationdate] without it making a difference.) To display this as monthly averages, I used the hierarchy limited to years and months, and went down one level in the chart.
Something seemed off so I checked first in Excel, then in the data source in PowerBI and yep: The averages in the PowerBI chart are complete bullshit.
Where did I go wrong? I assume it has something to do with the date hierarchy... So I created a date table as recommended (which....why?!) and linked it. That didn't make a difference.
Meanwhile in the data panel if I filter by the date column and calculate the average with the filtered selection of numbers externally, everything works as expected, so its not like there's a date formatting issue.
Do I have to create a calculated column with something akin to
DATE(YEAR([DateColumn]),MONTH([DateColumn]),1)
, then use that as the x-axis without the hierarchy, and hope nobody cares about the day in the label? Or is there something wrong with the measure used? I'm completely lost.

Power BI Desktop - Relative Date Slicer Defaulting to Days

Hoping this is a simple one to resolve.
I have a dataset, a SQL View, with the data imported into my PBIX. I have a date slicer and a number of tables, matrices and charts, over 2 pages. All update whenever I change my slicer, great.
One of my charts needs to show the last 12 months only. I choose Relative Date Filtering from the Visual level filters, select "is in the last", 12 and months from the various drop-downs. When I click Apply filter, my chart goes blank, even though there is data. When I click off the chart and back on again, the drop-down has changed to Days, not months. I have tried with various different options and always defaults back to days.
My Date field is definitely a Date. I have also tried adding a Date table and using that date too but the same thing happens.
Is it me or is there a bug?
Thanks

Calculate rates from previous month based on current month in order to make then visually comparable

Maybe this is an easy one but since I’m very new in DAX and PowerBI I can’t figure it out. My database has daily data ranging from MAY/17 to JUN/17 (and it’ll still going in the future). It has information of DATE, DAY, YRMTH (year-month), QT_APRV (approved customers) and QT_TOTAL (total consumers). Sample below (using Excel just to be quicker):
I wanted to create in PowerBI a bar chart with QT_TOTAL per day and a line chart with approved rate of consumer. For the rate, I used:
APPRV_RT = SUM(database[QT_APRV]/SUM(database[QT_TOTAL])
And then, selecting only a month by time in the chart (just like I want), I have:
Perfect, but now I want to create a new line chart, showing the approved rate in each respective day of the last month. Using my example, when june data are select, the first line chart has to show the daily approved rate of june AND the other the approved rate of may, in order to make it comparable (june1 -> may1; june12 -> may12 and so on). Here’s what I want:
How to make this automatically, in order to make each month comparable with the previous? I thought about some DAX formula involving a sum with filtering current month minus 1, I don’t know how to do it.
Any ideas?
UPDATE (07/08/2017)
I tried what Rasmus Dybkjær suggested me, and I thing I'm in the right path.
APPROVED_RATE_PREVIOUS_MONTH = CALCULATE([APPROVED_RATE_CURRENT_MONTH];PARALLELPERIOD(dCalendario[DataBase];-1;MONTH))
However, it returned the approved rate from the previous month as a whole (67,0% in May), not each day as I wanted:
Any suggestions?
You should be able to use the DAX function called PARALLELPERIOD() for this purpose. The PARALLELPERIOD() function takes a date column and shifts it a number of periods back or forward.
For example, you could use it like this to calculate your approved rate shifted one month back:
ApprovedRateLM =
CALCULATE(
DIVIDE(
SUM(database[QT_APRV]),
SUM(database[QT_TOTAL])
),
PARALLELPERIOD(database[Date],-1,month)
)
Note that it is important that your [Date] column contains a date type. Otherwise the PARALLELPERIOD function will not work.