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
BA1503
Frequent Visitor

Dynamic Percentage calculation based on Selection

Hi,

 

I'm trying to create a measure so that when you open the Power BI report, the values on the report are shows as Current Month (i.e. no date filter has been applied), however when a date filter is applied, then instead of going blank it should show the figures according to that month. 

 

My base measure is:

      Tasks = COUNTROWS(TABLE)

Based on this measure I have created another measure which is:

      Tasks2 = IF(ALL(TABLE),CALCULATE([Tasks],FILTER(Date,[This Month]=1)),[Tasks])

 

So, if no filters are selected then calculate current months total, else calculate selected date/month/year total. 

 

Any help would be useful. 

 

Thanks

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi @BA1503 ,

 

You can create measure Tasks  using DAX below, assuming the date filter is referred to field [DateKey].

 

Tasks = CALCULATE(COUNTROWS('TABLE'),ALLSELECTED('TABLE'[DateKey]))

 

4.png 

 

 

 

 

5.png

 

 

 

 

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Amy,

 

Thank you for your assistance. However I don't think that is showing what it is that I am after. So I will elaborate on my query to streamline what it is that I'm after.

 

Currently I have 3 slicers, Date, Month and Year. When nothing is selected in these slicers, the report shows information for over 6 years worth of data. So what I'm trying to do is, before any slicers are selected, the visuals would show results based on the current month, and then when a date/month/year is selected then the visuals would display results based on those slicers. 

 

image.png

As you can see in the image above, the left chart shows current months figures (no slicers selected, done by measure), the right chart shows all figures which would then get filtered by the slicers. 


So is there a way to combine these two, so that if no slicers have been selected it shows the left chart, but once the slicers get selected it shows results based on the selected value. 

 

Thanks again.

 

BA1503 

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.