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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
giovissimo
Helper I
Helper I

Default value for box

Hello everybody,

 

I hope someone can help me solve this problem.

I wrote the following code:

 

OrderedLastWeek =
CALCULATE (
COUNT ( Orders[OrderID] ),
FILTER (
ALL(
Orders[OrderYear],
Orders[OrderWeek]),
Orders[OrderYear] = 2022
),
Orders[OrderWeek] = MAX ( Orders[OrderWeek] )
)

 

to count the orders issued in the last week nationwide, and put the abobe measure in a box.

Then, in the same page I put a slicer called "Region" so that the box count only the orders issued in that particular region.

The thing is, the box was supposed to show the total amount of the issued orders if no selection was made on the Region filter, instead it only works is a selection is made, otherwise I get a Blank.

Since I didn't filter the Region, I expected the measure to work as it was meant. 

What's wrong with my code ?

 

Giovanni

2 REPLIES 2
tamerj1
Super User
Super User

Hi @giovissimo 
Please provide more details about your data model.

Hi tamerj1,

 

there's only one table as a data source, i.e. the Orders table.

Orders are issued by purchasing departments of every region (there are 20 regions) and, apart from order details which are not of interest here, the only parameters to be taken into account are the OrderDate and OrderID. I added two simple calculated columns to the table in order to have the week number and the year the order was issued, because the request was that the report showed the orders issued in the latest week, both nationwide and for every region. But, as I mentioned above, if no selection is made on the Region slicer, no data is shown in the box containing the measure (and the same happens if all the regions are selected through the CRTL key, or if the "Select all" is enabled and selected for that matter).

I hope I answered your request.

 

Giovanni

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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