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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Create multiple measures based on date

Hi, what I need to do is to create multiple measures based on date (14different measures/dates).

 

Example:

//today's date
MEASURE 'X'[XX] =
CALCULATE (
[ Quantity],
FILTER (
ALL ( 'Date' ),'Date'[X Date]= DATE(Year(Today()),Month(Today()),Day(Today())))

//today's date +1

MEASURE 'X'[XX+1] =
CALCULATE (
[ Quantity],
FILTER (
ALL ( 'Date' ),'Date'[X Date]= DATE(Year(Today()+1),Month(Today()+1),Day(Today()+1)))

etc..

 

Is it possible to create a loop that will create 14different measures based on date from today to today+14 instead of creating separated measures?

 

Thank you in advance!

 

1 ACCEPTED SOLUTION

HI @Anonymous,

In fact, my formula can generate multiple results based on the current parameter value if you use the parameter table field on the matrix column field.
AFAIK, current power bi desktop does not include features to bulk create multiple measures, so you need to manually create each of them instead of creating multiple measures at the same time.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

I'd like to suggest you create a parameter table with numeric values from 0 to 13, then you can use this field as the axis of your visual and use the Dax expression to extract the current parameter value for dynamic calculation.

New table:

ParaTable =
GENERATESERIES ( 0, 13, 1 )

Measure:

Dynamic quantity =
VAR selectedPara =
    MAX ( ParaTable[Values] )
RETURN
    CALCULATE (
        [ Quantity],
        FILTER ( ALL ( 'Date' ), 'Date'[X Date] = TODAY () + selectedPara )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Thank you for your advice, but I need all 14measures, just looking for a solution to create them all in one move (loop) :). All 14measures are visible in the final table. 

HI @Anonymous,

In fact, my formula can generate multiple results based on the current parameter value if you use the parameter table field on the matrix column field.
AFAIK, current power bi desktop does not include features to bulk create multiple measures, so you need to manually create each of them instead of creating multiple measures at the same time.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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