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
acanepa
Resolver I
Resolver I

[DAX] Dynamic Table and Summarize Table

Hello,

 

I'm using the following formula for generating a dynamic measure, creating a table (Slicer Table) on the side with each id and measure name. I have done this several times and works great.

 

switch(true,
max(id)=1,
[Measure 1],
blank()
)

 

The problem I'm facing right now is how to bypass that dynamic measure on a table on the fly.

 

For example

 

Measure 1=

var t1 = SUMMARIZE('Calendar',[Month],"v1",[Dynamic Measure])

RETURN(
AVERAGEX(t1,[v1])
)

At the time the measures make the calculations only consider the last ID for the Slicer table. If I add a filter on top of the measure, it works but only giving the concrete number

 

Measure 1=

var t1 = SUMMARIZE('Calendar',[Month],"v1",CALCULATE([Dynamic Measure],[ID]=2)

RETURN(
AVERAGEX(t1,[v1])
)

But if I change the number 2 to something like  MAX(ID) it would not recognize.

 

So I don't know how to pass the filters into the table on the fly for having direct connection to the slicer in the report.

 

1 ACCEPTED SOLUTION

Hi @v-jiascu-msft,

 

As I posted earlier my problem was around to generate a dynamic measure inside a table.

The solution I found rely on making a SWITCH operator with a generation of a table in each measure.

I was trying to calculate the average YOY for 2017*. Because is a measure is necessary to create a table to eliminate "row context".

 

The following calculation relies on Slicer table with the measures Traffic, Clicks and Users. The beauty of this you will need only one measure for display all measures at the same time and all measures share the same format. 

 

Calculation=

SWITCH(TRUE,
max(id)=1,
AVERAGEX(
SUMMARIZE(Calendar,'Calendar'[Month],"yoy",[YOY Traffic]),
[yoy]),
max(id)=2,
AVERAGEX(
SUMMARIZE(Calendar,'Calendar'[Month],"yoy",[YOY Clicks]),
[yoy]),
max(id)=3,
AVERAGEX(
SUMMARIZE(Calendar,'Calendar'[Month],"yoy",[YOY Users),
[yoy]),
BLANK()
)

* YOY means from a given month in 2017, compared with the same month 2016, i.e. Jan-2016 vs Jan-2017.

 

View solution in original post

4 REPLIES 4
v-jiascu-msft
Employee
Employee

Hi @acanepa,

 

Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.

 

Best Regards!
Dale

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

Hi @v-jiascu-msft,

 

As I posted earlier my problem was around to generate a dynamic measure inside a table.

The solution I found rely on making a SWITCH operator with a generation of a table in each measure.

I was trying to calculate the average YOY for 2017*. Because is a measure is necessary to create a table to eliminate "row context".

 

The following calculation relies on Slicer table with the measures Traffic, Clicks and Users. The beauty of this you will need only one measure for display all measures at the same time and all measures share the same format. 

 

Calculation=

SWITCH(TRUE,
max(id)=1,
AVERAGEX(
SUMMARIZE(Calendar,'Calendar'[Month],"yoy",[YOY Traffic]),
[yoy]),
max(id)=2,
AVERAGEX(
SUMMARIZE(Calendar,'Calendar'[Month],"yoy",[YOY Clicks]),
[yoy]),
max(id)=3,
AVERAGEX(
SUMMARIZE(Calendar,'Calendar'[Month],"yoy",[YOY Users),
[yoy]),
BLANK()
)

* YOY means from a given month in 2017, compared with the same month 2016, i.e. Jan-2016 vs Jan-2017.

 

Thanks for sharing with the Community.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Employee
Employee

Hi @acanepa,

 

Which step can you get the max ID? Did you try it like this?

Measure 1 =
VAR MaxID =
    MAX ( [ID] )
VAR t1 =
    SUMMARIZE (
        'Calendar',
        [Month],
        "v1", CALCULATE ( [Dynamic Measure], [ID] = MaxID )
    )
RETURN
    AVERAGEX ( t1, [v1] )

If this couldn't help, could you please share a sample?

 

Best Regards!

Dale

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

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.