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
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
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.

Top Solution Authors