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
Anonymous
Not applicable

What If parameter value as scalar in condition for added column

I'm trying to use a What If parameter to allow users to change the date range of a line and stacked column chart. This is a Pareto chart of categories of NC records. There is no date column in the table the chart reflects (table "summary") because different categories of NC records can have the same date. Including dates would give counts of NC records by category and date. And the Pareto needs to show counts of NC records by category.

Table "summary" summarizes table "NC records."

summary = SUMMARIZECOLUMNS(
      'NC records'[Category], 
      FILTER('NC records','NC records'[ShowNoShow] = "Show"),
      "NC count", DISTINCTCOUNT('NC records'[NC Num])
)

Column 'NC records'[ShowNoShow] was added to provide a way to limit the date range in the Pareto chart. Table "NC records" contains a minimum of 12 months of records. But users will want to see Pareto'd data in shorter date ranges; last 30 days, last 7 days, yesterday, etc.

ShowNoShow = IF(DATEDIFF('NC records'[Date],DATE(2020,4,22),Day) < 7,"Show","NoShow")

For this post, the ShowNoShow column labels NC records "Show" if their dates are in the 7 days ending 22-Apr-2020. In practice Today() is substituted for DATE(2020,4,22).

In an attempt to change a hard-wired 7-day range to a range users can control, I created the What If parameter, "Date Parameter." Date Parameter is added to a slicer and Date Parameter Value is substituted for the scalar 7 in the ShowNoShow expression.

ShowNoShow = IF(DATEDIFF('NC records'[Date],DATE(2020,4,22),Day) < SELECTEDVALUE('Date Parameter'[Date Parameter]),"Show","NoShow")

But SELECTEDVALUE('Date Parameter'[Date Parameter]) is apparently 0 becasue the Pareto chart now shows nothing.

What am I missing?

 

The Pareto chart scalar set to 1000 to show all data.

 

4.png

 

A separate page with table of both tables where scalare is set to 7. Works fine.

 

1.png

 

Same page with scalar set to SELECTEDVALUE. Both summary table and chart show nothing.


2.png

 

13 REPLIES 13

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.