PowerBI Dynamic Columns slicers - powerbi

I have tabular powerBI reports where few columns gets populated dynamically ( Like Year2022 , Year2023 ) within source query.
Report looks something like attache image.
Now Business Require slicer/Filter in such a way that He can filter those dynamic columns and he gets control to show and hide columns based on slicer selection with report.
I have find the solution but that is more suitable for filtering Static Columns , Is there any way we can filters Dynamic Columns through slicers .
Since Dynamic Columns numbers not fixed sometime ,
For one data refresh i can see Year2022, Year2023 and for other Year2025 ,Year2026.
Any solutions, direction will be appreciated
enter image description here

Related

How to get 1 column in a table report filtered by a slicer not in sync with the table

I am a PowerBi beginner and would like to know if it is possible to create a table report that behaves like explained in the attached picture (according to the fact table I have).
I tried to do it with a DAX measure using the following formulas but it does not work as I wish :
CALCULATE(SUM('Fact'[Invoice]),'Fact'[Customer] = SELECTEDVALUE('Fact'[Customer]))
CALCULATE(SUMX('Fact','Fact'[Invoice]),'Fact'[Customer]=SELECTEDVALUE('Fact'[Customer]))
The slicer does not filter the table in order to get all the product in the table even if the customer did not buy one.
Is it possible to do it ?
Many thanks

Power BI - How to view zeros in the matrix table visual

I'm currently building a report in Power BI. I added a matrix table along with its data. The matrix table just consist of sums per column (shown below).
There are multiple of slicers I have for the report. The problem is when I start filtering, the data disappears from the matrix. Instead of disappearing, I want it those values to be zero.
I have already used the measure: IF(ISBLANK(SUM(COUNT)), 0, SUM(COUNT) And it still did not work (shown below). What should I do so that the zeroes would appear on the matrix table?
There are two things you need for this approach to work
You need your Categories in a separate table to the rest of your data (joined by category ID) - if you don't have an ID, you can get away with Category name). You can build this table in DAX with something like CategoryTable = DISTINCT(MyData[CategoryName]). This new table and your data table need to be linked with a relationship. On your visual, use the Category from the Categories table and the measure you have created.
Make sure "Show items with no data" is checked on the matrix's fields.

Slicers showing all values - Power BI Desktop

I have a table in Power BI Desktop which has multiple columns (5 Dimension data connected with a Fact table - Star Schema).
I have now added 3 Slicer to filter data in above table but when I select the first slicer then the other slicers should show only available dimensions data but it is showing all the available data.
I tried changing Cross filter Direction to both from single in Manage Relationship but it works for only one column but not to all with the below error or warning message.
NOTE: I do have few more Pages in the same Visualization report which contains separate fact table with same dimension keys.
Please let me know how to resolve this or any other suggestions.
Use the following measure to filter through your dimensions
Cross Filter = INT( NOT( ISEMPTY( 'Your FACT TABLE') ) )
Then dragg this measure in every slicer into the filter pane and select the option is equal to 1.
My power bi version is in spanish but you will get the idea.
----------------------------------------

Power BI / DAX return values from table from rows filtered out by slicer

I have a table visualisation that shows the populations of countries and a toggle switch that flips between 'sold' and 'unsold'. (This works with a measure that checks is a country is present in a sales table and assigns a 1 or 0 which is then used as a filter on the table visualisation).
Various slicers in the dashboard are used to filter the data model and retain the details of sales. When 'unsold' is selected therefore, the relevant countries are already filtered out of the countries data table and it is not possible to display them with their populations.
At the moment the workaround is to use a duplicate countries table that only has a one way filter, so that the rows remain regardless of filtering. This means that other slicers which interact with the rest of the data model don't filter the table visualisation as desired.
I am sure this must be possible using some combination of CALCULATE(), FILTER() and ALL() but I haven't managed to achieve this.
N.B. I can force the unsold countries to appear in a table visualisation using a constant measure (with formula: measure_name = 0) in a column .
Apologies if this is not very well explained, any help much appreciated.
Thanks for reading,
S
Image attached to (hopefully!) explain problem better.
Real scenario is more complicated hence not screenshotting from PBI.

Power BI - DAX query to remove duplicated rows in SUM calculation

My scenario is this: SalesValue have been entered for multiple sessions namely Lunch, Breakfast, dinner which is grouped by SessionKey in numbers. The same SalesValue repeats at times for 2 or more sessions for a given production plan date, based on MenuKey, RawMaterialKey and IngSFKey.
I need to use DAX query in Power BI to remove duplicated SalesValue based on ProductionPlanDate and SessionKey for a particular MenuKey in a given date.
I have attached the screenshot of a sample value range of SalesValue containing duplicate values for the same date across different sessions for your reference. For example, rows 7 and 14 have the same ProductionPlanDate, SessionKey, MenuKey, and SalesValue.
So you have a table with one "Grain" and you want to change the "Grain" by using a subset of the columns. Specifically you want only rows with distinct columns ProductionPlanDate, SessionKey, MenuKey and SalesValue
To do this in a DAX query you would use
evaluate
summarize
( 'table name'
, 'table name'[ProductionPlanDate]
, 'table name'[SessionKey]
, 'table name'[MenuKey]
, 'table name'[SalesValue]
)
You could provide this to create a calculated table or provide it to each measure that needs to work with this coarser grained data set.
However as it seems you are in Power BI the more appropriate place to do this would be to create your coarser grained table using Power Query (via the Edit Queries section of Power BI).
This is better than doing it in DAX as DAX is more tuned to analytics where Power Query is tuned to data transformation - and you want to do data transformation.
You can either keep the table that you have now alongside the new modified or replace it accordingly.
option A will just change your incoming table to have the new coarse grain.
option B will keep your original table and have the new grained table alongside it. Note that this will mean any Power BI visuals that you have created will need to be "rewired" to use the new table.
To do the transform in Power Query, the steps for both options are
Go to the Edit Queries area on PowerBI
Select the columns that you want to create the new Grain (i.e. ProductionPlanDate, SessionKey, MenuKey and SalesValue) by holding ctrl and clicking the column headers of each column in turn.
Right click on the column header for one of the selected columns and select "Remove Duplicates"
If you want option B, simply first copy the existing table by using "Reference" then do the same thing as follows:
Find your existing table on the left Queries section, r-click and click Reference
Rename the new table something appropriate
Apply the transform steps to the new table as above
Click Close & Apply and rewire any existing visuals that you need to use the new table
If you find you don't need your old table you can R-click on it in Power Query again and uncheck "Enable Load" so that PowerBI will not see it anymore.