Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
diegoadum
Helper I
Helper I

show columns based on a condition

Hi folks, I'm working on a table that will show actual and plan for the current fiscal year. The idea is to find out the way to show only YTD info, which mean to show only columns from the beggining of the year until the current month. Here is the tricky part. the plan is fully loaded for the 12 periods, so if I want to compare Actual vs Plan for the periods that I have no actuals,  the variations are high and the whole table turns into red (I didn't mention that I have applied conditional formating to the table).

 

So, is there a way to show or hide columns for a table in PowerBi? Somethine like conditional show that exist in other tools?

 

Many thank in advance!!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

For those who don't know the formula in Power Query:

relative Month:
(Date.Year([Date])*12+Date.Month([Date])) -
(Date.Year(DateTime.LocalNow())*12+Date.Month(DateTime.LocalNow()))

 

relative Year:
Date.Year([Date]) - Date.Year(DateTime.LocalNow()) 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @diegoadum

You can achieve this by adding 2 columns in your calendar dimension (date dimension): 

- relative month &
- relative year

in the report you have to use two filters on report (or page) level:
relative year = 0
and
relative month <0

Feel free to ask if you need assistance with the formulas for relative month and relative year.

Anonymous
Not applicable

For those who don't know the formula in Power Query:

relative Month:
(Date.Year([Date])*12+Date.Month([Date])) -
(Date.Year(DateTime.LocalNow())*12+Date.Month(DateTime.LocalNow()))

 

relative Year:
Date.Year([Date]) - Date.Year(DateTime.LocalNow()) 

 

Hi @Anonymous, thank for the time to reply this. I think I got your suggestion and I'm going to take your offer to get some help with the formulas for the relative month and year!

 

Again, thank in advance!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.