One Chart- One Measure at a time being displayed - powerbi

Can I have multiple charts in Power BI or create different chart types and create a parameter so that I only display 1 chart at a time. Is that a possibility within Power BI?
For example:
Year over Year
Month by Month
A measure of Month/Average as different measures.
Can I have a drop down as to which measures are selected and have the ability to be only select them one at the time?

It seems like you're asking a few questions there. I can answer one of them:
Can I have a drop down as to which measures are selected and have the ability to be only select them one at the time?
You could create a table
My Measures = DATATABLE("My Measure", STRING, {{"Measure 1"}, {"Measure 2"}})
and on that table a measure
Selected Measure = SWITCH(SELECTEDVALUE('My Measures'[My Measure], BLANK()), "Measure 1", [Measure 1], "Measure 2", [Measure 2])
and then use the [My Measure] column as a slicer (which can be a drop-down menu). Then when you select "Measure 1" from the slicer, the [Selected Measure] measure will switch to showing the values of [Measure 1].
This works best if all of the measures that you want to interchange have the same number formatting.

Related

Dynamic TopN Selection problem while selecting another filter slicer?

In Power BI, I have created a dynamic TopN visual where we can see top 3 to top 10 teams in terms of total goals scored in FIFA World Cups. I am using a parameter called Top Rankings for TopN selection. However, the TopN selection does not work when I am selecting another slicer Year. When I am selecting the year slicer, the visual shows close to 10 teams although I have selected only 4 teams in the slicer parameter. I am providing the dax measure, table which is used to create the measure and the visual as well.
Dax -
# TopN Teams by Goal Scored =
VAR ranking = RANKX(ALLSELECTED(All_WC_matches[Teams]), [Overall Scored],,DESC,Dense)
Return
IF(
ranking <= 'Top Rankings'[Top Rankings Value],
[Overall Scored]
)
Only TopN slicer selected
Both TopN and Year slicers selected
Table used for the measure
This is the link to my power bi report
https://app.powerbi.com/view?r=eyJrIjoiZWRkNjRkZmQtZGM5Ny00OTQyLTlmYjgtYzNhZGUxYTFkMTQ2IiwidCI6IjllMmY0M2FmLTExYzMtNGQ5NC1iYTVlLTc3Y2QwNzJlOWMwYiJ9
Link to my Power BI file
https://drive.google.com/file/d/194jBF5M8KMLSAcfvzDjeotftdOahtnZG/view?usp=sharing
I am expecting that TopN selection will be affected by other slicers. However, the number of top teams selected will remain unchanged.
Your ranking is working as designed. i.e.
Selecting top 3 and 1930 returns 7 results as you have 5 teams all scoring 7 goals. Look at the table below for an explanation.

Show filtered data when no value is selected in slicer in power bi

I have two tables, once for slicer and other one is for details table. The details table have a InvoiceDate column where some rows have blank InvoiceDate. The slicer table looks like below:
The slicer will only show value of of ID 1, like below.
Initially I want slicer to be un checked and the data should show only rows where InvoiceDate is Blank. Once User select the Slicer as Include Invoiced Records, it should show both full details i.e. Rows with Blank + Non-Empty dates rows.
There are two other ways of doing what you want that are probably more 'correct' but I'll also describe a way to provide the behavior you describe.
Option one: Delete your second table. Add a calculated column to your details table as follows:
Invoice Status = IF (ISBLANK([Invoice Date]) = TRUE(), "Not yet invoiced", "Invoiced")
Create a slicer using [Invoice Status] and simply default it to show 'not invoiced.' If users want to see the invoiced records, they just check that box in the slicer as well.
Option Two: Use Bookmarks and buttons to produce the desired effect. Create two buttons, one that says 'Include Invoiced Customers' and another that says 'Hide Invoiced Customers' -- create two bookmarks where one has the invoiced customers filtered out of the visual and one where the invoiced customers aren't filtered. Set each button's "Action" to the appropriate bookmark.
Option Three Keep your 'slicer' table. Let's assume it's called 'Invoice Filter Selection.' Create a new measure:
IncludeDetailFilter =
IF (ISFILTERED('Invoice Filter Selection'[Value]) = True(),
1,
IF (ISBLANK(MAX(InvoiceDetails[Invoice Date])) = TRUE(), 1, 0)
)
When the slicer has a selection, it will be considered 'Filtered' and you will pass into the first branch of the IF where the measure always evaluates to 1. When the slicer isn't selected, the measure will evaluate to 1 or 0 depending on whether or not there are any values for Invoice Date in the row. Add this new measure as a filter on your invoice detail visual.
Unchecked:
Checked:
Hope it Helps.

Measure to show the data as "daily","weekly","monthly" in power bi?

I have data of few years of submitted and unsubmitted application, which I am showing in an area chart. I want to add filters like "daily"(it should show today's submitted & unsubmitted), "weekly"
( it should show the current week data), "monthly" (it should show the current month data )
My data format:
Please help me with those three measures, which I can use as a filter. I have already done the Dynamically Add or Remove Measures to a slicer.
Following I want to achieve, Internally those three options "daily", "weekly" and "monthly" I have linked with three dummy Measures. Or else you can suggest any other approach.
Currently, I got a suggestion from powerbi community,
to use to measure for the submitted & unsubmitted, which DAX formular & link I am sharing below, Now the graph is changing as per the option clicked but the values it is sowing is wrong.
Measure :
Submitted Sum =
var Daily_Sum= CALCULATE(SUM(Applicant_data[Submitted]),ALLEXCEPT(Applicant_data, Applicant_data[Postion Type ],Applicant_data[Date]))
var Weekly_Sum=CALCULATE(SUM(Applicant_data[Submitted]),FILTER(ALLSELECTED(Applicant_data), YEAR(Applicant_data[Date]) =YEAR(MAX(Applicant_data[Date]))&&WEEKNUM(Applicant_data[Date]) =WEEKNUM(MAX(Applicant_data[Date]))))
Var Monthly_Sum= CALCULATE(SUM(Applicant_data[Submitted]),FILTER(ALLSELECTED(Applicant_data), YEAR(Applicant_data[Date]) =YEAR(MAX(Applicant_data[Date]))&&MONTH(Applicant_data[Date]) =MONTH(MAX(Applicant_data[Date]))))
return
IF(ISFILTERED('_Measure'[Selection]),
SWITCH(SELECTEDVALUE('_Measure'[Selection]),
"Daily", Daily_Sum,
"Weekly", Weekly_Sum,
"Monthly", Monthly_Sum
),
BLANK()
)
https://community.powerbi.com/t5/Desktop/Measure-to-show-the-data-as-daily-weekly-monthly-in-power-bi/m-p/1039068#M488207
There are 2 common ways to make this work :
Way-1 : Utilizing Power Query
Create a "Date Table" using the date column in power query
Add 3 calculated columns that extracts month, week and day info from the "Date" column in the newly created "Date Table".
Now, unpivot the "month", "day" and "year" columns and load the file.
Create a one to many relationship with "Date" columns as common in both tables and there you go.
Way-2 (Using Drill-through buttons).
Use the recent feature update of Power BI, i.e., drilling the data using buttons. So, you just need to create a date hierarchy and then drill through using buttons for "month", "week"and "day".
I hope this will help you.
If you still got the doubt then please send me the dataset and I will give you an detailed explanation on this.

How to show last six months data(one row for each month) in MDX query based on selected month filter in Power BI report?

I have created a cube with one fact table and 5 dimension which includes one Date dimension. Hierarchy of date dimension is Year -> Quater -> Month. Here I want to select the last six months data from selected month using mdx query. The output should be Month (Row Level) and Measures on Column level.
Thought of creating a dynamic named set but power BI doesn't consume named sets.
Can anyone please suggest a way to do it in MDX either using a disconnected date dimension or any idea in Power BI?
Take a look at the sample below
select
[Measures].[Internet Sales Amount]
on 0
,
[Date].[Calendar].[Month].&[2012]&[4].lag(6):
[Date].[Calendar].[Month].&[2012]&[4]
on 1
from
[Adventure Works]
Result

Power bi filter column by slicer

I have a Clustered column chart and for the Legend field and have to switch between 2 columns based on a slicer:
if no slicer is filtered then use column0 for Legend
if slicer is filtered then use column1 for Legend
I tried adding a calculated column like this
Column = IF(ISFILTERED(Table1[slicer]) = TRUE(), Table1[column1], Table1[column0])
And then use this column as Legend.
But this doesn't work!
Can you please advice me how to do it right?
You can't filter calculated columns by slicers.
Calculated columns are only calculated once - when you load/refresh your data model. After that, they contain fixed, static values that can not respond to slicers.
To achieve your goal, you will need to redesign your chart using measures, not calculated columns. Then your formula will look like this:
[Measure to Chart] = IF(ISFILTERED(Table1[slicer]), [Measure 1], [Measure 2])
If you want more help, I would recommend to post another question with more information about your data model and desired outcome.