Forum Discussion

bml123's avatar
bml123
Icon for Post Patron rankPost Patron
4 years ago
Solved

Smart narrative in Power Bi

Hi,

 

I have data like this

 

IdDateAmount
105/01/2022100
108/02/2022-50

 

I want to show narrative like this

"Id1 amount had reduced from 100 to 50 on 08/02/2022"

How do I achieve that? 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi bml123 ,

     

    Please create a new column.

     

    Change = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Amount]>=EARLIER('Table'[Amount])))

     

    Then create four more measures.

     

    id num = CALCULATE(VALUES('Table'[Id]))
    last date = MAX('Table'[Date])
    start num = CALCULATE(SUM('Table'[Change]),'Table'[Date]=MIN('Table'[Date]))
    last num = CALCULATE(SUM('Table'[Change]),'Table'[Date]=MAX('Table'[Date]))
    condition = IF([start num]>[last num],"reduced","increased")

     

    Finally, create a new Smart narrative and insert these five measures as values into appropriate positions.

    If you are using table or matrix type visuals, unfortunately,smart narrative doesn't support these yet. We could use tooltips to display this message, which is obviously not smart enough.

    Attach the pbix file for reference. Hope it helps.

     

    Best Regards,
    Community Support Team_Gao


    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

2 Replies

  • bml123 , Create a measure like this

     

    var _max = maxx(filter(allselected(Table), Table[ID] = max(Table[ID])), Table[Date])
    var _min = maxx(filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[Date] < _max), Table[Date])
    return
    return
    calculate( sum(Table[Value]), filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[Date]=_max)) -calculate( sum(Table[Value]), filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[Date] =_min))

     

    and use that

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi bml123 ,

     

    Please create a new column.

     

    Change = CALCULATE(SUM('Table'[Amount]),FILTER(ALL('Table'),'Table'[Amount]>=EARLIER('Table'[Amount])))

     

    Then create four more measures.

     

    id num = CALCULATE(VALUES('Table'[Id]))
    last date = MAX('Table'[Date])
    start num = CALCULATE(SUM('Table'[Change]),'Table'[Date]=MIN('Table'[Date]))
    last num = CALCULATE(SUM('Table'[Change]),'Table'[Date]=MAX('Table'[Date]))
    condition = IF([start num]>[last num],"reduced","increased")

     

    Finally, create a new Smart narrative and insert these five measures as values into appropriate positions.

    If you are using table or matrix type visuals, unfortunately,smart narrative doesn't support these yet. We could use tooltips to display this message, which is obviously not smart enough.

    Attach the pbix file for reference. Hope it helps.

     

    Best Regards,
    Community Support Team_Gao


    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!