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

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.

Related

Using Excel to return a yes/no response from a data table, using multiple conditions in separate columns

I'm trying to refine a report dashboard utilized at my workplace. The process that I'm trying to automate is;
Data is generated into a worksheet via a query table (Worksheet called Imported Data)
From that table, i'm wanting to look at 3 separate columns for 3 conditions
Those conditions are a) Team, B) Frequency, C) Month and D) Yes (from a ye/no option)
Providing all those conditions are met Eg, Team A, Monthly, February, Yes, I want Excel to produce a response of Compliant, otherwise say Non-compliant, onto another worksheet called Governance Complaince
The response for this is on a separate work sheet.
The main query table that is generated has around 8 Team choices, 6 Frequency options, with 12 month and then the 2 (obviously) yes/no options.
I've tried a few different formulas to get this to work, but I only ever get the True value from the formula.
I Feel that maybe the formula is stopping once it sees the first Team A selection (Which by nature of how the query table is generated, is the first result in the Team column) and then ignoring the remainder of the formula, despite my best attempts.
The current formula I'm using is
=IF(COUNTIFS('Imported Data'!A:A,"Team A")+COUNTIFS('Imported Data'!C:C,"Monthly")+COUNTIFS('Imported Data'!F:F,"February")+COUNTIFS('Imported Data'!I:I,"Yes")>1,"Compliant","Non-compliant")
I've tried
=IF(COUNTIFS('Imported Data'!A:A,"Team A")+COUNTIFS('Imported Data'!C:C,"Monthly")+COUNTIFS('Imported Data'!F:F,"February")+COUNTIFS('Imported Data'!I:I,"Yes")=ROWS('Imported Data'!A1:Z500),"Compliant","Non-compliant")
=IF(AND('Imported Data'!A:A,"Team A")+AND('Imported Data'!C:C,"Monthly")+AND('Imported Data'!F:F,"February")+AND('Imported Data'!I:I,"Yes"),"Compliant","Non-compliant")
=IF(AND('Imported Data'!A:A,"Team A")+AND('Imported Data'!C:C,"Monthly")+AND('Imported Data'!F:F,"February")+AND('Imported Data'!I:I,"Yes")=ROWS('Imported Data'!A1:Z500),"Compliant","Non-compliant")
All I get is a #Value error, or only the Compliant value, despite any changes made to the data the formula references.
All the cells are text, there is no numerical data in the tables. The formula is placed into a cell in another worksheet called Governance Compliance
Essentially I want the formula to be able to look at the query table data, output the Ture/False value into a monthly tracker (This formula will be replicated over about 26 different audits for 8 teams) automatically, cutting down on manual processing. I've been able to get the date to then look at a quarterly array of teams and return a complaint/non-complaint result into another worksheet fine using
=IF(COUNTIF('Governance Compliance'!E11:G19,"Compliant")=ROWS('Governance Compliance'!E11:G19),"Yes","No")
And I thought that my 3 condition if statement to get the compliant result into the Governance Compliance worksheet would just be an expansion of conditions on this formula, but I am clearly wrong.
The query table is sorted alphabetically by Team if that makes a difference.

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.

How can I display months without no data?

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.

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.

Quicksight not showing months with no data (null?)

My visual's x-axis is Date, aggregated by month, and the y-axis is total sales (sum of costs). For some months, I had no sales, but Quicksight ignores these and only shows me the months that do have data in them, even though I want the exact number of months that I specify in my time range parameter.
So, when I ask to show the last 12 months, Quicksight shows me only 4, since for the other 8 I don't have any records.
How can I make those months show as 0, instead of being excluded altogether?
---------- EDIT (possible solution) --------------
Since my analysis relied on selecting a specific product code and only getting the sums for that, I took off the filter, and instead used a calculated field of:
sumIf(sales, productCode = $productCodeParam$).
I imagine this approach works on really small datasets too if you want to use sumIf and list all of your categories there, but otherwise, by omitting data with filtering you have nothing to result in 0, since Quicksight doesn't evaluate sum(null + null) into 0.